diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 19009050a..fe9f54bb2 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -59c4c0f3d5f0ef00cd5350b5674e941a7606d91a \ No newline at end of file +universe:/home/parth.bansal/vn1/universe \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 12e5b87bb..3cc5c7b76 100644 --- a/.gitattributes +++ b/.gitattributes @@ -271,6 +271,10 @@ service/pipelines/impl.go linguist-generated=true service/pipelines/interface.go linguist-generated=true service/pipelines/model.go linguist-generated=true service/pkg.go linguist-generated=true +service/postgres/api.go linguist-generated=true +service/postgres/impl.go linguist-generated=true +service/postgres/interface.go linguist-generated=true +service/postgres/model.go linguist-generated=true service/provisioning/api.go linguist-generated=true service/provisioning/impl.go linguist-generated=true service/provisioning/interface.go linguist-generated=true diff --git a/account_client.go b/account_client.go index c6321cc1c..37c2ce3a7 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. // @@ -527,6 +530,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..2bf499390 100755 --- a/experimental/mocks/mock_workspace_client.go +++ b/experimental/mocks/mock_workspace_client.go @@ -24,6 +24,7 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/mocks/service/ml" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/oauth2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/pipelines" + "github.com/databricks/databricks-sdk-go/experimental/mocks/service/postgres" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/serving" "github.com/databricks/databricks-sdk-go/experimental/mocks/service/settings" @@ -118,6 +119,7 @@ func NewMockWorkspaceClient(t interface { PolicyComplianceForClusters: compute.NewMockPolicyComplianceForClustersInterface(t), PolicyComplianceForJobs: jobs.NewMockPolicyComplianceForJobsInterface(t), PolicyFamilies: compute.NewMockPolicyFamiliesInterface(t), + Postgres: postgres.NewMockPostgresInterface(t), ProviderExchangeFilters: marketplace.NewMockProviderExchangeFiltersInterface(t), ProviderExchanges: marketplace.NewMockProviderExchangesInterface(t), ProviderFiles: marketplace.NewMockProviderFilesInterface(t), @@ -130,6 +132,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 +157,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), @@ -908,6 +912,14 @@ func (m *MockWorkspaceClient) GetMockPolicyFamiliesAPI() *compute.MockPolicyFami return api } +func (m *MockWorkspaceClient) GetMockPostgresAPI() *postgres.MockPostgresInterface { + api, ok := m.WorkspaceClient.Postgres.(*postgres.MockPostgresInterface) + if !ok { + panic(fmt.Sprintf("expected Postgres to be *postgres.MockPostgresInterface, actual was %T", m.WorkspaceClient.Postgres)) + } + return api +} + func (m *MockWorkspaceClient) GetMockProviderExchangeFiltersAPI() *marketplace.MockProviderExchangeFiltersInterface { api, ok := m.WorkspaceClient.ProviderExchangeFilters.(*marketplace.MockProviderExchangeFiltersInterface) if !ok { @@ -1004,6 +1016,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 +1216,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/iamv2/mock_account_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go index 7cff9c711..7f850afd0 100644 --- a/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go +++ b/experimental/mocks/service/iamv2/mock_account_iam_v2_interface.go @@ -22,28 +22,806 @@ func (_m *MockAccountIamV2Interface) EXPECT() *MockAccountIamV2Interface_Expecte return &MockAccountIamV2Interface_Expecter{mock: &_m.Mock} } +// CreateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateGroup(ctx context.Context, request iamv2.CreateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup' +type MockAccountIamV2Interface_CreateGroup_Call struct { + *mock.Call +} + +// CreateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateGroup_Call { + return &MockAccountIamV2Interface_CreateGroup_Call{Call: _e.mock.On("CreateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupRequest)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateGroup_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_CreateGroup_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateServicePrincipal(ctx context.Context, request iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipal' +type MockAccountIamV2Interface_CreateServicePrincipal_Call struct { + *mock.Call +} + +// CreateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + return &MockAccountIamV2Interface_CreateServicePrincipal_Call{Call: _e.mock.On("CreateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalRequest)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_CreateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// CreateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateUser(ctx context.Context, request iamv2.CreateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser' +type MockAccountIamV2Interface_CreateUser_Call struct { + *mock.Call +} + +// CreateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateUser_Call { + return &MockAccountIamV2Interface_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Run(run func(ctx context.Context, request iamv2.CreateUserRequest)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateUser_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_CreateUser_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) CreateWorkspaceAccessDetail(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetail' +type MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) CreateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call{Call: _e.mock.On("CreateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_CreateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteGroup(ctx context.Context, request iamv2.DeleteGroupRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroup") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroup' +type MockAccountIamV2Interface_DeleteGroup_Call struct { + *mock.Call +} + +// DeleteGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteGroup_Call { + return &MockAccountIamV2Interface_DeleteGroup_Call{Call: _e.mock.On("DeleteGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupRequest)) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteGroup_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupRequest) error) *MockAccountIamV2Interface_DeleteGroup_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteServicePrincipal(ctx context.Context, request iamv2.DeleteServicePrincipalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipal' +type MockAccountIamV2Interface_DeleteServicePrincipal_Call struct { + *mock.Call +} + +// DeleteServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + return &MockAccountIamV2Interface_DeleteServicePrincipal_Call{Call: _e.mock.On("DeleteServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalRequest)) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalRequest) error) *MockAccountIamV2Interface_DeleteServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteUser(ctx context.Context, request iamv2.DeleteUserRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUser") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser' +type MockAccountIamV2Interface_DeleteUser_Call struct { + *mock.Call +} + +// DeleteUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteUser_Call { + return &MockAccountIamV2Interface_DeleteUser_Call{Call: _e.mock.On("DeleteUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserRequest)) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteUser_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserRequest) error) *MockAccountIamV2Interface_DeleteUser_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) DeleteWorkspaceAccessDetail(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetail") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetail' +type MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) DeleteWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) Return(_a0 error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailRequest) error) *MockAccountIamV2Interface_DeleteWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// GetGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetGroup(ctx context.Context, request iamv2.GetGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup' +type MockAccountIamV2Interface_GetGroup_Call struct { + *mock.Call +} + +// GetGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) GetGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetGroup_Call { + return &MockAccountIamV2Interface_GetGroup_Call{Call: _e.mock.On("GetGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Run(run func(ctx context.Context, request iamv2.GetGroupRequest)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetGroup_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_GetGroup_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetServicePrincipal(ctx context.Context, request iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipal' +type MockAccountIamV2Interface_GetServicePrincipal_Call struct { + *mock.Call +} + +// GetServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) GetServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetServicePrincipal_Call { + return &MockAccountIamV2Interface_GetServicePrincipal_Call{Call: _e.mock.On("GetServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalRequest)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_GetServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// GetUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) GetUser(ctx context.Context, request iamv2.GetUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser' +type MockAccountIamV2Interface_GetUser_Call struct { + *mock.Call +} + +// GetUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserRequest +func (_e *MockAccountIamV2Interface_Expecter) GetUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetUser_Call { + return &MockAccountIamV2Interface_GetUser_Call{Call: _e.mock.On("GetUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Run(run func(ctx context.Context, request iamv2.GetUserRequest)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetUser_Call) RunAndReturn(run func(context.Context, iamv2.GetUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_GetUser_Call { + _c.Call.Return(run) + return _c +} + // GetWorkspaceAccessDetail provides a mock function with given fields: ctx, request func (_m *MockAccountIamV2Interface) GetWorkspaceAccessDetail(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetWorkspaceAccessDetail") + panic("no return value specified for GetWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetail' +type MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) GetWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call{Call: _e.mock.On("GetWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + +// ListGroups provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListGroups(ctx context.Context, request iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroups") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroups' +type MockAccountIamV2Interface_ListGroups_Call struct { + *mock.Call +} + +// ListGroups is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListGroups(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListGroups_Call { + return &MockAccountIamV2Interface_ListGroups_Call{Call: _e.mock.On("ListGroups", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsRequest)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListGroups_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsRequest) (*iamv2.ListGroupsResponse, error)) *MockAccountIamV2Interface_ListGroups_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipals provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListServicePrincipals(ctx context.Context, request iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipals") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListServicePrincipals_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipals' +type MockAccountIamV2Interface_ListServicePrincipals_Call struct { + *mock.Call +} + +// ListServicePrincipals is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListServicePrincipals(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListServicePrincipals_Call { + return &MockAccountIamV2Interface_ListServicePrincipals_Call{Call: _e.mock.On("ListServicePrincipals", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsRequest)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListServicePrincipals_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockAccountIamV2Interface_ListServicePrincipals_Call { + _c.Call.Return(run) + return _c +} + +// ListUsers provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListUsers(ctx context.Context, request iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsers") } - var r0 *iamv2.WorkspaceAccessDetail + var r0 *iamv2.ListUsersResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersRequest) *iamv2.ListUsersResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + r0 = ret.Get(0).(*iamv2.ListUsersResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) @@ -52,31 +830,90 @@ func (_m *MockAccountIamV2Interface) GetWorkspaceAccessDetail(ctx context.Contex return r0, r1 } -// MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetail' -type MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call struct { +// MockAccountIamV2Interface_ListUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsers' +type MockAccountIamV2Interface_ListUsers_Call struct { *mock.Call } -// GetWorkspaceAccessDetail is a helper method to define mock.On call +// ListUsers is a helper method to define mock.On call // - ctx context.Context -// - request iamv2.GetWorkspaceAccessDetailRequest -func (_e *MockAccountIamV2Interface_Expecter) GetWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { - return &MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call{Call: _e.mock.On("GetWorkspaceAccessDetail", ctx, request)} +// - request iamv2.ListUsersRequest +func (_e *MockAccountIamV2Interface_Expecter) ListUsers(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListUsers_Call { + return &MockAccountIamV2Interface_ListUsers_Call{Call: _e.mock.On("ListUsers", ctx, request)} } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) Run(run func(ctx context.Context, request iamv2.ListUsersRequest)) *MockAccountIamV2Interface_ListUsers_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailRequest)) + run(args[0].(context.Context), args[1].(iamv2.ListUsersRequest)) }) return _c } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockAccountIamV2Interface_ListUsers_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_GetWorkspaceAccessDetail_Call { +func (_c *MockAccountIamV2Interface_ListUsers_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersRequest) (*iamv2.ListUsersResponse, error)) *MockAccountIamV2Interface_ListUsers_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetails provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) ListWorkspaceAccessDetails(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetails") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetails' +type MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetails is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsRequest +func (_e *MockAccountIamV2Interface_Expecter) ListWorkspaceAccessDetails(ctx interface{}, request interface{}) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + return &MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call{Call: _e.mock.On("ListWorkspaceAccessDetails", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsRequest)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockAccountIamV2Interface_ListWorkspaceAccessDetails_Call { _c.Call.Return(run) return _c } @@ -258,6 +1095,242 @@ func (_c *MockAccountIamV2Interface_ResolveUser_Call) RunAndReturn(run func(cont return _c } +// UpdateGroup provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateGroup(ctx context.Context, request iamv2.UpdateGroupRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroup") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroup' +type MockAccountIamV2Interface_UpdateGroup_Call struct { + *mock.Call +} + +// UpdateGroup is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateGroup(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateGroup_Call { + return &MockAccountIamV2Interface_UpdateGroup_Call{Call: _e.mock.On("UpdateGroup", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupRequest)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) Return(_a0 *iamv2.Group, _a1 error) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateGroup_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupRequest) (*iamv2.Group, error)) *MockAccountIamV2Interface_UpdateGroup_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipal provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateServicePrincipal(ctx context.Context, request iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipal") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateServicePrincipal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipal' +type MockAccountIamV2Interface_UpdateServicePrincipal_Call struct { + *mock.Call +} + +// UpdateServicePrincipal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateServicePrincipal(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + return &MockAccountIamV2Interface_UpdateServicePrincipal_Call{Call: _e.mock.On("UpdateServicePrincipal", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalRequest)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateServicePrincipal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalRequest) (*iamv2.ServicePrincipal, error)) *MockAccountIamV2Interface_UpdateServicePrincipal_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUser provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateUser(ctx context.Context, request iamv2.UpdateUserRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUser") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser' +type MockAccountIamV2Interface_UpdateUser_Call struct { + *mock.Call +} + +// UpdateUser is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateUser(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateUser_Call { + return &MockAccountIamV2Interface_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserRequest)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) Return(_a0 *iamv2.User, _a1 error) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateUser_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserRequest) (*iamv2.User, error)) *MockAccountIamV2Interface_UpdateUser_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetail provides a mock function with given fields: ctx, request +func (_m *MockAccountIamV2Interface) UpdateWorkspaceAccessDetail(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetail") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetail' +type MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetail is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailRequest +func (_e *MockAccountIamV2Interface_Expecter) UpdateWorkspaceAccessDetail(ctx interface{}, request interface{}) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + return &MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetail", ctx, request)} +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailRequest)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailRequest)) + }) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockAccountIamV2Interface_UpdateWorkspaceAccessDetail_Call { + _c.Call.Return(run) + return _c +} + // NewMockAccountIamV2Interface creates a new instance of MockAccountIamV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockAccountIamV2Interface(t interface { diff --git a/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go index 4cdf0af8a..a696d842a 100644 --- a/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go +++ b/experimental/mocks/service/iamv2/mock_workspace_iam_v2_interface.go @@ -22,28 +22,806 @@ func (_m *MockWorkspaceIamV2Interface) EXPECT() *MockWorkspaceIamV2Interface_Exp return &MockWorkspaceIamV2Interface_Expecter{mock: &_m.Mock} } +// CreateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateGroupProxy(ctx context.Context, request iamv2.CreateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroupProxy' +type MockWorkspaceIamV2Interface_CreateGroupProxy_Call struct { + *mock.Call +} + +// CreateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_CreateGroupProxy_Call{Call: _e.mock.On("CreateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateGroupProxyRequest)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_CreateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateServicePrincipalProxy(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call struct { + *mock.Call +} + +// CreateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call{Call: _e.mock.On("CreateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_CreateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateUserProxy(ctx context.Context, request iamv2.CreateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUserProxy' +type MockWorkspaceIamV2Interface_CreateUserProxy_Call struct { + *mock.Call +} + +// CreateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + return &MockWorkspaceIamV2Interface_CreateUserProxy_Call{Call: _e.mock.On("CreateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.CreateUserProxyRequest)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.CreateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_CreateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// CreateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) CreateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// CreateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.CreateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) CreateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("CreateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.CreateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.CreateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.CreateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_CreateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// DeleteGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteGroupProxy(ctx context.Context, request iamv2.DeleteGroupProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteGroupProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteGroupProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroupProxy' +type MockWorkspaceIamV2Interface_DeleteGroupProxy_Call struct { + *mock.Call +} + +// DeleteGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteGroupProxy_Call{Call: _e.mock.On("DeleteGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteGroupProxyRequest)) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteGroupProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteServicePrincipalProxy(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteServicePrincipalProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteServicePrincipalProxy' +type MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call struct { + *mock.Call +} + +// DeleteServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call{Call: _e.mock.On("DeleteServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteServicePrincipalProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteUserProxy(ctx context.Context, request iamv2.DeleteUserProxyRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteUserProxy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteUserProxyRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUserProxy' +type MockWorkspaceIamV2Interface_DeleteUserProxy_Call struct { + *mock.Call +} + +// DeleteUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + return &MockWorkspaceIamV2Interface_DeleteUserProxy_Call{Call: _e.mock.On("DeleteUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Run(run func(ctx context.Context, request iamv2.DeleteUserProxyRequest)) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.DeleteUserProxyRequest) error) *MockWorkspaceIamV2Interface_DeleteUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// DeleteWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) DeleteWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest) error { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for DeleteWorkspaceAccessDetailLocal") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// DeleteWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.DeleteWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) DeleteWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("DeleteWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.DeleteWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.DeleteWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) Return(_a0 error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.DeleteWorkspaceAccessDetailLocalRequest) error) *MockWorkspaceIamV2Interface_DeleteWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// GetGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetGroupProxy(ctx context.Context, request iamv2.GetGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupProxy' +type MockWorkspaceIamV2Interface_GetGroupProxy_Call struct { + *mock.Call +} + +// GetGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + return &MockWorkspaceIamV2Interface_GetGroupProxy_Call{Call: _e.mock.On("GetGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.GetGroupProxyRequest)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_GetGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetServicePrincipalProxy(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServicePrincipalProxy' +type MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call struct { + *mock.Call +} + +// GetServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call{Call: _e.mock.On("GetServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.GetServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_GetServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// GetUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) GetUserProxy(ctx context.Context, request iamv2.GetUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserProxy' +type MockWorkspaceIamV2Interface_GetUserProxy_Call struct { + *mock.Call +} + +// GetUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + return &MockWorkspaceIamV2Interface_GetUserProxy_Call{Call: _e.mock.On("GetUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Run(run func(ctx context.Context, request iamv2.GetUserProxyRequest)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.GetUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_GetUserProxy_Call { + _c.Call.Return(run) + return _c +} + // GetWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request func (_m *MockWorkspaceIamV2Interface) GetWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { ret := _m.Called(ctx, request) if len(ret) == 0 { - panic("no return value specified for GetWorkspaceAccessDetailLocal") + panic("no return value specified for GetWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// GetWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.GetWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) GetWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("GetWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + +// ListGroupsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListGroupsProxy(ctx context.Context, request iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListGroupsProxy") + } + + var r0 *iamv2.ListGroupsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListGroupsProxyRequest) *iamv2.ListGroupsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListGroupsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListGroupsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListGroupsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListGroupsProxy' +type MockWorkspaceIamV2Interface_ListGroupsProxy_Call struct { + *mock.Call +} + +// ListGroupsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListGroupsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListGroupsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + return &MockWorkspaceIamV2Interface_ListGroupsProxy_Call{Call: _e.mock.On("ListGroupsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListGroupsProxyRequest)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListGroupsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) Return(_a0 *iamv2.ListGroupsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListGroupsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListGroupsProxyRequest) (*iamv2.ListGroupsResponse, error)) *MockWorkspaceIamV2Interface_ListGroupsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListServicePrincipalsProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListServicePrincipalsProxy(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListServicePrincipalsProxy") + } + + var r0 *iamv2.ListServicePrincipalsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) *iamv2.ListServicePrincipalsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListServicePrincipalsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListServicePrincipalsProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServicePrincipalsProxy' +type MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call struct { + *mock.Call +} + +// ListServicePrincipalsProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListServicePrincipalsProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListServicePrincipalsProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + return &MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call{Call: _e.mock.On("ListServicePrincipalsProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Run(run func(ctx context.Context, request iamv2.ListServicePrincipalsProxyRequest)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListServicePrincipalsProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) Return(_a0 *iamv2.ListServicePrincipalsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListServicePrincipalsProxyRequest) (*iamv2.ListServicePrincipalsResponse, error)) *MockWorkspaceIamV2Interface_ListServicePrincipalsProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListUsersProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListUsersProxy(ctx context.Context, request iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListUsersProxy") } - var r0 *iamv2.WorkspaceAccessDetail + var r0 *iamv2.ListUsersResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)); ok { return rf(ctx, request) } - if rf, ok := ret.Get(0).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListUsersProxyRequest) *iamv2.ListUsersResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + r0 = ret.Get(0).(*iamv2.ListUsersResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListUsersProxyRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) @@ -52,31 +830,90 @@ func (_m *MockWorkspaceIamV2Interface) GetWorkspaceAccessDetailLocal(ctx context return r0, r1 } -// MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWorkspaceAccessDetailLocal' -type MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call struct { +// MockWorkspaceIamV2Interface_ListUsersProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUsersProxy' +type MockWorkspaceIamV2Interface_ListUsersProxy_Call struct { *mock.Call } -// GetWorkspaceAccessDetailLocal is a helper method to define mock.On call +// ListUsersProxy is a helper method to define mock.On call // - ctx context.Context -// - request iamv2.GetWorkspaceAccessDetailLocalRequest -func (_e *MockWorkspaceIamV2Interface_Expecter) GetWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { - return &MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("GetWorkspaceAccessDetailLocal", ctx, request)} +// - request iamv2.ListUsersProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListUsersProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + return &MockWorkspaceIamV2Interface_ListUsersProxy_Call{Call: _e.mock.On("ListUsersProxy", ctx, request)} } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.GetWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Run(run func(ctx context.Context, request iamv2.ListUsersProxyRequest)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(iamv2.GetWorkspaceAccessDetailLocalRequest)) + run(args[0].(context.Context), args[1].(iamv2.ListUsersProxyRequest)) }) return _c } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) Return(_a0 *iamv2.ListUsersResponse, _a1 error) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.GetWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_GetWorkspaceAccessDetailLocal_Call { +func (_c *MockWorkspaceIamV2Interface_ListUsersProxy_Call) RunAndReturn(run func(context.Context, iamv2.ListUsersProxyRequest) (*iamv2.ListUsersResponse, error)) *MockWorkspaceIamV2Interface_ListUsersProxy_Call { + _c.Call.Return(run) + return _c +} + +// ListWorkspaceAccessDetailsLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) ListWorkspaceAccessDetailsLocal(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListWorkspaceAccessDetailsLocal") + } + + var r0 *iamv2.ListWorkspaceAccessDetailsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) *iamv2.ListWorkspaceAccessDetailsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ListWorkspaceAccessDetailsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspaceAccessDetailsLocal' +type MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call struct { + *mock.Call +} + +// ListWorkspaceAccessDetailsLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.ListWorkspaceAccessDetailsLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) ListWorkspaceAccessDetailsLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + return &MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call{Call: _e.mock.On("ListWorkspaceAccessDetailsLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Run(run func(ctx context.Context, request iamv2.ListWorkspaceAccessDetailsLocalRequest)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.ListWorkspaceAccessDetailsLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) Return(_a0 *iamv2.ListWorkspaceAccessDetailsResponse, _a1 error) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call) RunAndReturn(run func(context.Context, iamv2.ListWorkspaceAccessDetailsLocalRequest) (*iamv2.ListWorkspaceAccessDetailsResponse, error)) *MockWorkspaceIamV2Interface_ListWorkspaceAccessDetailsLocal_Call { _c.Call.Return(run) return _c } @@ -258,6 +1095,242 @@ func (_c *MockWorkspaceIamV2Interface_ResolveUserProxy_Call) RunAndReturn(run fu return _c } +// UpdateGroupProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateGroupProxy(ctx context.Context, request iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateGroupProxy") + } + + var r0 *iamv2.Group + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateGroupProxyRequest) *iamv2.Group); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.Group) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateGroupProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateGroupProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupProxy' +type MockWorkspaceIamV2Interface_UpdateGroupProxy_Call struct { + *mock.Call +} + +// UpdateGroupProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateGroupProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateGroupProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateGroupProxy_Call{Call: _e.mock.On("UpdateGroupProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateGroupProxyRequest)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateGroupProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) Return(_a0 *iamv2.Group, _a1 error) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateGroupProxyRequest) (*iamv2.Group, error)) *MockWorkspaceIamV2Interface_UpdateGroupProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateServicePrincipalProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateServicePrincipalProxy(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateServicePrincipalProxy") + } + + var r0 *iamv2.ServicePrincipal + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) *iamv2.ServicePrincipal); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.ServicePrincipal) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateServicePrincipalProxy' +type MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call struct { + *mock.Call +} + +// UpdateServicePrincipalProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateServicePrincipalProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateServicePrincipalProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call{Call: _e.mock.On("UpdateServicePrincipalProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateServicePrincipalProxyRequest)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateServicePrincipalProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) Return(_a0 *iamv2.ServicePrincipal, _a1 error) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateServicePrincipalProxyRequest) (*iamv2.ServicePrincipal, error)) *MockWorkspaceIamV2Interface_UpdateServicePrincipalProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUserProxy provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateUserProxy(ctx context.Context, request iamv2.UpdateUserProxyRequest) (*iamv2.User, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateUserProxy") + } + + var r0 *iamv2.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateUserProxyRequest) *iamv2.User); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateUserProxyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateUserProxy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUserProxy' +type MockWorkspaceIamV2Interface_UpdateUserProxy_Call struct { + *mock.Call +} + +// UpdateUserProxy is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateUserProxyRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateUserProxy(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + return &MockWorkspaceIamV2Interface_UpdateUserProxy_Call{Call: _e.mock.On("UpdateUserProxy", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Run(run func(ctx context.Context, request iamv2.UpdateUserProxyRequest)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateUserProxyRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) Return(_a0 *iamv2.User, _a1 error) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateUserProxy_Call) RunAndReturn(run func(context.Context, iamv2.UpdateUserProxyRequest) (*iamv2.User, error)) *MockWorkspaceIamV2Interface_UpdateUserProxy_Call { + _c.Call.Return(run) + return _c +} + +// UpdateWorkspaceAccessDetailLocal provides a mock function with given fields: ctx, request +func (_m *MockWorkspaceIamV2Interface) UpdateWorkspaceAccessDetailLocal(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateWorkspaceAccessDetailLocal") + } + + var r0 *iamv2.WorkspaceAccessDetail + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) *iamv2.WorkspaceAccessDetail); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*iamv2.WorkspaceAccessDetail) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateWorkspaceAccessDetailLocal' +type MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call struct { + *mock.Call +} + +// UpdateWorkspaceAccessDetailLocal is a helper method to define mock.On call +// - ctx context.Context +// - request iamv2.UpdateWorkspaceAccessDetailLocalRequest +func (_e *MockWorkspaceIamV2Interface_Expecter) UpdateWorkspaceAccessDetailLocal(ctx interface{}, request interface{}) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + return &MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call{Call: _e.mock.On("UpdateWorkspaceAccessDetailLocal", ctx, request)} +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Run(run func(ctx context.Context, request iamv2.UpdateWorkspaceAccessDetailLocalRequest)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(iamv2.UpdateWorkspaceAccessDetailLocalRequest)) + }) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) Return(_a0 *iamv2.WorkspaceAccessDetail, _a1 error) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call) RunAndReturn(run func(context.Context, iamv2.UpdateWorkspaceAccessDetailLocalRequest) (*iamv2.WorkspaceAccessDetail, error)) *MockWorkspaceIamV2Interface_UpdateWorkspaceAccessDetailLocal_Call { + _c.Call.Return(run) + return _c +} + // NewMockWorkspaceIamV2Interface creates a new instance of MockWorkspaceIamV2Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockWorkspaceIamV2Interface(t interface { diff --git a/experimental/mocks/service/ml/mock_experiments_interface.go b/experimental/mocks/service/ml/mock_experiments_interface.go index 20e4fce27..89a70eefa 100644 --- a/experimental/mocks/service/ml/mock_experiments_interface.go +++ b/experimental/mocks/service/ml/mock_experiments_interface.go @@ -993,6 +993,65 @@ func (_c *MockExperimentsInterface_GetLoggedModelByModelId_Call) RunAndReturn(ru return _c } +// GetLoggedModels provides a mock function with given fields: ctx, request +func (_m *MockExperimentsInterface) GetLoggedModels(ctx context.Context, request ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetLoggedModels") + } + + var r0 *ml.GetLoggedModelsRequestResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.GetLoggedModelsRequest) *ml.GetLoggedModelsRequestResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.GetLoggedModelsRequestResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.GetLoggedModelsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockExperimentsInterface_GetLoggedModels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLoggedModels' +type MockExperimentsInterface_GetLoggedModels_Call struct { + *mock.Call +} + +// GetLoggedModels is a helper method to define mock.On call +// - ctx context.Context +// - request ml.GetLoggedModelsRequest +func (_e *MockExperimentsInterface_Expecter) GetLoggedModels(ctx interface{}, request interface{}) *MockExperimentsInterface_GetLoggedModels_Call { + return &MockExperimentsInterface_GetLoggedModels_Call{Call: _e.mock.On("GetLoggedModels", ctx, request)} +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Run(run func(ctx context.Context, request ml.GetLoggedModelsRequest)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.GetLoggedModelsRequest)) + }) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) Return(_a0 *ml.GetLoggedModelsRequestResponse, _a1 error) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockExperimentsInterface_GetLoggedModels_Call) RunAndReturn(run func(context.Context, ml.GetLoggedModelsRequest) (*ml.GetLoggedModelsRequestResponse, error)) *MockExperimentsInterface_GetLoggedModels_Call { + _c.Call.Return(run) + return _c +} + // GetPermissionLevels provides a mock function with given fields: ctx, request func (_m *MockExperimentsInterface) GetPermissionLevels(ctx context.Context, request ml.GetExperimentPermissionLevelsRequest) (*ml.GetExperimentPermissionLevelsResponse, error) { ret := _m.Called(ctx, request) diff --git a/experimental/mocks/service/ml/mock_feature_engineering_interface.go b/experimental/mocks/service/ml/mock_feature_engineering_interface.go index 478f94fff..af59cd3df 100644 --- a/experimental/mocks/service/ml/mock_feature_engineering_interface.go +++ b/experimental/mocks/service/ml/mock_feature_engineering_interface.go @@ -24,6 +24,65 @@ func (_m *MockFeatureEngineeringInterface) EXPECT() *MockFeatureEngineeringInter return &MockFeatureEngineeringInterface_Expecter{mock: &_m.Mock} } +// BatchCreateMaterializedFeatures provides a mock function with given fields: ctx, request +func (_m *MockFeatureEngineeringInterface) BatchCreateMaterializedFeatures(ctx context.Context, request ml.BatchCreateMaterializedFeaturesRequest) (*ml.BatchCreateMaterializedFeaturesResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for BatchCreateMaterializedFeatures") + } + + var r0 *ml.BatchCreateMaterializedFeaturesResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ml.BatchCreateMaterializedFeaturesRequest) (*ml.BatchCreateMaterializedFeaturesResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, ml.BatchCreateMaterializedFeaturesRequest) *ml.BatchCreateMaterializedFeaturesResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ml.BatchCreateMaterializedFeaturesResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ml.BatchCreateMaterializedFeaturesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchCreateMaterializedFeatures' +type MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call struct { + *mock.Call +} + +// BatchCreateMaterializedFeatures is a helper method to define mock.On call +// - ctx context.Context +// - request ml.BatchCreateMaterializedFeaturesRequest +func (_e *MockFeatureEngineeringInterface_Expecter) BatchCreateMaterializedFeatures(ctx interface{}, request interface{}) *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call { + return &MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call{Call: _e.mock.On("BatchCreateMaterializedFeatures", ctx, request)} +} + +func (_c *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call) Run(run func(ctx context.Context, request ml.BatchCreateMaterializedFeaturesRequest)) *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ml.BatchCreateMaterializedFeaturesRequest)) + }) + return _c +} + +func (_c *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call) Return(_a0 *ml.BatchCreateMaterializedFeaturesResponse, _a1 error) *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call) RunAndReturn(run func(context.Context, ml.BatchCreateMaterializedFeaturesRequest) (*ml.BatchCreateMaterializedFeaturesResponse, error)) *MockFeatureEngineeringInterface_BatchCreateMaterializedFeatures_Call { + _c.Call.Return(run) + return _c +} + // CreateFeature provides a mock function with given fields: ctx, request func (_m *MockFeatureEngineeringInterface) CreateFeature(ctx context.Context, request ml.CreateFeatureRequest) (*ml.Feature, 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/postgres/mock_create_database_branch_operation_interface.go b/experimental/mocks/service/postgres/mock_create_database_branch_operation_interface.go new file mode 100644 index 000000000..3f742fdbd --- /dev/null +++ b/experimental/mocks/service/postgres/mock_create_database_branch_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockCreateDatabaseBranchOperationInterface is an autogenerated mock type for the CreateDatabaseBranchOperationInterface type +type MockCreateDatabaseBranchOperationInterface struct { + mock.Mock +} + +type MockCreateDatabaseBranchOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCreateDatabaseBranchOperationInterface) EXPECT() *MockCreateDatabaseBranchOperationInterface_Expecter { + return &MockCreateDatabaseBranchOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockCreateDatabaseBranchOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseBranchOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockCreateDatabaseBranchOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockCreateDatabaseBranchOperationInterface_Expecter) Done() *MockCreateDatabaseBranchOperationInterface_Done_Call { + return &MockCreateDatabaseBranchOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Done_Call) Run(run func()) *MockCreateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockCreateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockCreateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockCreateDatabaseBranchOperationInterface) Metadata() (*postgres.DatabaseBranchOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseBranchOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseBranchOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseBranchOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseBranchOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseBranchOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockCreateDatabaseBranchOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockCreateDatabaseBranchOperationInterface_Expecter) Metadata() *MockCreateDatabaseBranchOperationInterface_Metadata_Call { + return &MockCreateDatabaseBranchOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Metadata_Call) Run(run func()) *MockCreateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseBranchOperationMetadata, _a1 error) *MockCreateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseBranchOperationMetadata, error)) *MockCreateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockCreateDatabaseBranchOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockCreateDatabaseBranchOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockCreateDatabaseBranchOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockCreateDatabaseBranchOperationInterface_Expecter) Name() *MockCreateDatabaseBranchOperationInterface_Name_Call { + return &MockCreateDatabaseBranchOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Name_Call) Run(run func()) *MockCreateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Name_Call) Return(_a0 string) *MockCreateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Name_Call) RunAndReturn(run func() string) *MockCreateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockCreateDatabaseBranchOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseBranch, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseBranch, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseBranch); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseBranchOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockCreateDatabaseBranchOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockCreateDatabaseBranchOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockCreateDatabaseBranchOperationInterface_Wait_Call { + return &MockCreateDatabaseBranchOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockCreateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseBranch, _a1 error) *MockCreateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseBranchOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseBranch, error)) *MockCreateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCreateDatabaseBranchOperationInterface creates a new instance of MockCreateDatabaseBranchOperationInterface. 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 NewMockCreateDatabaseBranchOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCreateDatabaseBranchOperationInterface { + mock := &MockCreateDatabaseBranchOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_create_database_endpoint_operation_interface.go b/experimental/mocks/service/postgres/mock_create_database_endpoint_operation_interface.go new file mode 100644 index 000000000..b3a42e384 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_create_database_endpoint_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockCreateDatabaseEndpointOperationInterface is an autogenerated mock type for the CreateDatabaseEndpointOperationInterface type +type MockCreateDatabaseEndpointOperationInterface struct { + mock.Mock +} + +type MockCreateDatabaseEndpointOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCreateDatabaseEndpointOperationInterface) EXPECT() *MockCreateDatabaseEndpointOperationInterface_Expecter { + return &MockCreateDatabaseEndpointOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockCreateDatabaseEndpointOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseEndpointOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockCreateDatabaseEndpointOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockCreateDatabaseEndpointOperationInterface_Expecter) Done() *MockCreateDatabaseEndpointOperationInterface_Done_Call { + return &MockCreateDatabaseEndpointOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Done_Call) Run(run func()) *MockCreateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockCreateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockCreateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockCreateDatabaseEndpointOperationInterface) Metadata() (*postgres.DatabaseEndpointOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseEndpointOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseEndpointOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseEndpointOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpointOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseEndpointOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockCreateDatabaseEndpointOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockCreateDatabaseEndpointOperationInterface_Expecter) Metadata() *MockCreateDatabaseEndpointOperationInterface_Metadata_Call { + return &MockCreateDatabaseEndpointOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Metadata_Call) Run(run func()) *MockCreateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseEndpointOperationMetadata, _a1 error) *MockCreateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseEndpointOperationMetadata, error)) *MockCreateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockCreateDatabaseEndpointOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockCreateDatabaseEndpointOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockCreateDatabaseEndpointOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockCreateDatabaseEndpointOperationInterface_Expecter) Name() *MockCreateDatabaseEndpointOperationInterface_Name_Call { + return &MockCreateDatabaseEndpointOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Name_Call) Run(run func()) *MockCreateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Name_Call) Return(_a0 string) *MockCreateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Name_Call) RunAndReturn(run func() string) *MockCreateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockCreateDatabaseEndpointOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseEndpoint, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseEndpoint); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseEndpointOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockCreateDatabaseEndpointOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockCreateDatabaseEndpointOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockCreateDatabaseEndpointOperationInterface_Wait_Call { + return &MockCreateDatabaseEndpointOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockCreateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseEndpoint, _a1 error) *MockCreateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseEndpointOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)) *MockCreateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCreateDatabaseEndpointOperationInterface creates a new instance of MockCreateDatabaseEndpointOperationInterface. 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 NewMockCreateDatabaseEndpointOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCreateDatabaseEndpointOperationInterface { + mock := &MockCreateDatabaseEndpointOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_create_database_project_operation_interface.go b/experimental/mocks/service/postgres/mock_create_database_project_operation_interface.go new file mode 100644 index 000000000..b89fa2d12 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_create_database_project_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockCreateDatabaseProjectOperationInterface is an autogenerated mock type for the CreateDatabaseProjectOperationInterface type +type MockCreateDatabaseProjectOperationInterface struct { + mock.Mock +} + +type MockCreateDatabaseProjectOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCreateDatabaseProjectOperationInterface) EXPECT() *MockCreateDatabaseProjectOperationInterface_Expecter { + return &MockCreateDatabaseProjectOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockCreateDatabaseProjectOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseProjectOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockCreateDatabaseProjectOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockCreateDatabaseProjectOperationInterface_Expecter) Done() *MockCreateDatabaseProjectOperationInterface_Done_Call { + return &MockCreateDatabaseProjectOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Done_Call) Run(run func()) *MockCreateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockCreateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockCreateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockCreateDatabaseProjectOperationInterface) Metadata() (*postgres.DatabaseProjectOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseProjectOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseProjectOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseProjectOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseProjectOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseProjectOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockCreateDatabaseProjectOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockCreateDatabaseProjectOperationInterface_Expecter) Metadata() *MockCreateDatabaseProjectOperationInterface_Metadata_Call { + return &MockCreateDatabaseProjectOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Metadata_Call) Run(run func()) *MockCreateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseProjectOperationMetadata, _a1 error) *MockCreateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseProjectOperationMetadata, error)) *MockCreateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockCreateDatabaseProjectOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockCreateDatabaseProjectOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockCreateDatabaseProjectOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockCreateDatabaseProjectOperationInterface_Expecter) Name() *MockCreateDatabaseProjectOperationInterface_Name_Call { + return &MockCreateDatabaseProjectOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Name_Call) Run(run func()) *MockCreateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Name_Call) Return(_a0 string) *MockCreateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Name_Call) RunAndReturn(run func() string) *MockCreateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockCreateDatabaseProjectOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseProject, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseProject, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseProject); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockCreateDatabaseProjectOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockCreateDatabaseProjectOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockCreateDatabaseProjectOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockCreateDatabaseProjectOperationInterface_Wait_Call { + return &MockCreateDatabaseProjectOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockCreateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseProject, _a1 error) *MockCreateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockCreateDatabaseProjectOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseProject, error)) *MockCreateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockCreateDatabaseProjectOperationInterface creates a new instance of MockCreateDatabaseProjectOperationInterface. 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 NewMockCreateDatabaseProjectOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCreateDatabaseProjectOperationInterface { + mock := &MockCreateDatabaseProjectOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_postgres_interface.go b/experimental/mocks/service/postgres/mock_postgres_interface.go new file mode 100644 index 000000000..889237c01 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_postgres_interface.go @@ -0,0 +1,1153 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + listing "github.com/databricks/databricks-sdk-go/listing" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockPostgresInterface is an autogenerated mock type for the PostgresInterface type +type MockPostgresInterface struct { + mock.Mock +} + +type MockPostgresInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPostgresInterface) EXPECT() *MockPostgresInterface_Expecter { + return &MockPostgresInterface_Expecter{mock: &_m.Mock} +} + +// CreateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) CreateDatabaseBranch(ctx context.Context, request postgres.CreateDatabaseBranchRequest) (postgres.CreateDatabaseBranchOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseBranch") + } + + var r0 postgres.CreateDatabaseBranchOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseBranchRequest) (postgres.CreateDatabaseBranchOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseBranchRequest) postgres.CreateDatabaseBranchOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.CreateDatabaseBranchOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.CreateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_CreateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseBranch' +type MockPostgresInterface_CreateDatabaseBranch_Call struct { + *mock.Call +} + +// CreateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.CreateDatabaseBranchRequest +func (_e *MockPostgresInterface_Expecter) CreateDatabaseBranch(ctx interface{}, request interface{}) *MockPostgresInterface_CreateDatabaseBranch_Call { + return &MockPostgresInterface_CreateDatabaseBranch_Call{Call: _e.mock.On("CreateDatabaseBranch", ctx, request)} +} + +func (_c *MockPostgresInterface_CreateDatabaseBranch_Call) Run(run func(ctx context.Context, request postgres.CreateDatabaseBranchRequest)) *MockPostgresInterface_CreateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.CreateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseBranch_Call) Return(_a0 postgres.CreateDatabaseBranchOperationInterface, _a1 error) *MockPostgresInterface_CreateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseBranch_Call) RunAndReturn(run func(context.Context, postgres.CreateDatabaseBranchRequest) (postgres.CreateDatabaseBranchOperationInterface, error)) *MockPostgresInterface_CreateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) CreateDatabaseEndpoint(ctx context.Context, request postgres.CreateDatabaseEndpointRequest) (postgres.CreateDatabaseEndpointOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseEndpoint") + } + + var r0 postgres.CreateDatabaseEndpointOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseEndpointRequest) (postgres.CreateDatabaseEndpointOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseEndpointRequest) postgres.CreateDatabaseEndpointOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.CreateDatabaseEndpointOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.CreateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_CreateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseEndpoint' +type MockPostgresInterface_CreateDatabaseEndpoint_Call struct { + *mock.Call +} + +// CreateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.CreateDatabaseEndpointRequest +func (_e *MockPostgresInterface_Expecter) CreateDatabaseEndpoint(ctx interface{}, request interface{}) *MockPostgresInterface_CreateDatabaseEndpoint_Call { + return &MockPostgresInterface_CreateDatabaseEndpoint_Call{Call: _e.mock.On("CreateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockPostgresInterface_CreateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request postgres.CreateDatabaseEndpointRequest)) *MockPostgresInterface_CreateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.CreateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseEndpoint_Call) Return(_a0 postgres.CreateDatabaseEndpointOperationInterface, _a1 error) *MockPostgresInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, postgres.CreateDatabaseEndpointRequest) (postgres.CreateDatabaseEndpointOperationInterface, error)) *MockPostgresInterface_CreateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// CreateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) CreateDatabaseProject(ctx context.Context, request postgres.CreateDatabaseProjectRequest) (postgres.CreateDatabaseProjectOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for CreateDatabaseProject") + } + + var r0 postgres.CreateDatabaseProjectOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseProjectRequest) (postgres.CreateDatabaseProjectOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.CreateDatabaseProjectRequest) postgres.CreateDatabaseProjectOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.CreateDatabaseProjectOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.CreateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_CreateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDatabaseProject' +type MockPostgresInterface_CreateDatabaseProject_Call struct { + *mock.Call +} + +// CreateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.CreateDatabaseProjectRequest +func (_e *MockPostgresInterface_Expecter) CreateDatabaseProject(ctx interface{}, request interface{}) *MockPostgresInterface_CreateDatabaseProject_Call { + return &MockPostgresInterface_CreateDatabaseProject_Call{Call: _e.mock.On("CreateDatabaseProject", ctx, request)} +} + +func (_c *MockPostgresInterface_CreateDatabaseProject_Call) Run(run func(ctx context.Context, request postgres.CreateDatabaseProjectRequest)) *MockPostgresInterface_CreateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.CreateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseProject_Call) Return(_a0 postgres.CreateDatabaseProjectOperationInterface, _a1 error) *MockPostgresInterface_CreateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_CreateDatabaseProject_Call) RunAndReturn(run func(context.Context, postgres.CreateDatabaseProjectRequest) (postgres.CreateDatabaseProjectOperationInterface, error)) *MockPostgresInterface_CreateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) DeleteDatabaseBranch(ctx context.Context, request postgres.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, postgres.DeleteDatabaseBranchRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockPostgresInterface_DeleteDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseBranch' +type MockPostgresInterface_DeleteDatabaseBranch_Call struct { + *mock.Call +} + +// DeleteDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.DeleteDatabaseBranchRequest +func (_e *MockPostgresInterface_Expecter) DeleteDatabaseBranch(ctx interface{}, request interface{}) *MockPostgresInterface_DeleteDatabaseBranch_Call { + return &MockPostgresInterface_DeleteDatabaseBranch_Call{Call: _e.mock.On("DeleteDatabaseBranch", ctx, request)} +} + +func (_c *MockPostgresInterface_DeleteDatabaseBranch_Call) Run(run func(ctx context.Context, request postgres.DeleteDatabaseBranchRequest)) *MockPostgresInterface_DeleteDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.DeleteDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseBranch_Call) Return(_a0 error) *MockPostgresInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseBranch_Call) RunAndReturn(run func(context.Context, postgres.DeleteDatabaseBranchRequest) error) *MockPostgresInterface_DeleteDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) DeleteDatabaseEndpoint(ctx context.Context, request postgres.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, postgres.DeleteDatabaseEndpointRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockPostgresInterface_DeleteDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseEndpoint' +type MockPostgresInterface_DeleteDatabaseEndpoint_Call struct { + *mock.Call +} + +// DeleteDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.DeleteDatabaseEndpointRequest +func (_e *MockPostgresInterface_Expecter) DeleteDatabaseEndpoint(ctx interface{}, request interface{}) *MockPostgresInterface_DeleteDatabaseEndpoint_Call { + return &MockPostgresInterface_DeleteDatabaseEndpoint_Call{Call: _e.mock.On("DeleteDatabaseEndpoint", ctx, request)} +} + +func (_c *MockPostgresInterface_DeleteDatabaseEndpoint_Call) Run(run func(ctx context.Context, request postgres.DeleteDatabaseEndpointRequest)) *MockPostgresInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.DeleteDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseEndpoint_Call) Return(_a0 error) *MockPostgresInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, postgres.DeleteDatabaseEndpointRequest) error) *MockPostgresInterface_DeleteDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// DeleteDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) DeleteDatabaseProject(ctx context.Context, request postgres.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, postgres.DeleteDatabaseProjectRequest) error); ok { + r0 = rf(ctx, request) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockPostgresInterface_DeleteDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteDatabaseProject' +type MockPostgresInterface_DeleteDatabaseProject_Call struct { + *mock.Call +} + +// DeleteDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.DeleteDatabaseProjectRequest +func (_e *MockPostgresInterface_Expecter) DeleteDatabaseProject(ctx interface{}, request interface{}) *MockPostgresInterface_DeleteDatabaseProject_Call { + return &MockPostgresInterface_DeleteDatabaseProject_Call{Call: _e.mock.On("DeleteDatabaseProject", ctx, request)} +} + +func (_c *MockPostgresInterface_DeleteDatabaseProject_Call) Run(run func(ctx context.Context, request postgres.DeleteDatabaseProjectRequest)) *MockPostgresInterface_DeleteDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.DeleteDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseProject_Call) Return(_a0 error) *MockPostgresInterface_DeleteDatabaseProject_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_DeleteDatabaseProject_Call) RunAndReturn(run func(context.Context, postgres.DeleteDatabaseProjectRequest) error) *MockPostgresInterface_DeleteDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetDatabaseBranch(ctx context.Context, request postgres.GetDatabaseBranchRequest) (*postgres.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseBranch") + } + + var r0 *postgres.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseBranchRequest) (*postgres.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseBranchRequest) *postgres.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseBranch' +type MockPostgresInterface_GetDatabaseBranch_Call struct { + *mock.Call +} + +// GetDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetDatabaseBranchRequest +func (_e *MockPostgresInterface_Expecter) GetDatabaseBranch(ctx interface{}, request interface{}) *MockPostgresInterface_GetDatabaseBranch_Call { + return &MockPostgresInterface_GetDatabaseBranch_Call{Call: _e.mock.On("GetDatabaseBranch", ctx, request)} +} + +func (_c *MockPostgresInterface_GetDatabaseBranch_Call) Run(run func(ctx context.Context, request postgres.GetDatabaseBranchRequest)) *MockPostgresInterface_GetDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseBranch_Call) Return(_a0 *postgres.DatabaseBranch, _a1 error) *MockPostgresInterface_GetDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseBranch_Call) RunAndReturn(run func(context.Context, postgres.GetDatabaseBranchRequest) (*postgres.DatabaseBranch, error)) *MockPostgresInterface_GetDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetDatabaseEndpoint(ctx context.Context, request postgres.GetDatabaseEndpointRequest) (*postgres.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseEndpoint") + } + + var r0 *postgres.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseEndpointRequest) (*postgres.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseEndpointRequest) *postgres.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseEndpoint' +type MockPostgresInterface_GetDatabaseEndpoint_Call struct { + *mock.Call +} + +// GetDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetDatabaseEndpointRequest +func (_e *MockPostgresInterface_Expecter) GetDatabaseEndpoint(ctx interface{}, request interface{}) *MockPostgresInterface_GetDatabaseEndpoint_Call { + return &MockPostgresInterface_GetDatabaseEndpoint_Call{Call: _e.mock.On("GetDatabaseEndpoint", ctx, request)} +} + +func (_c *MockPostgresInterface_GetDatabaseEndpoint_Call) Run(run func(ctx context.Context, request postgres.GetDatabaseEndpointRequest)) *MockPostgresInterface_GetDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseEndpoint_Call) Return(_a0 *postgres.DatabaseEndpoint, _a1 error) *MockPostgresInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, postgres.GetDatabaseEndpointRequest) (*postgres.DatabaseEndpoint, error)) *MockPostgresInterface_GetDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseOperation provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetDatabaseOperation(ctx context.Context, request postgres.GetOperationRequest) (*postgres.Operation, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseOperation") + } + + var r0 *postgres.Operation + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetOperationRequest) (*postgres.Operation, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetOperationRequest) *postgres.Operation); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.Operation) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetOperationRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetDatabaseOperation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseOperation' +type MockPostgresInterface_GetDatabaseOperation_Call struct { + *mock.Call +} + +// GetDatabaseOperation is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetOperationRequest +func (_e *MockPostgresInterface_Expecter) GetDatabaseOperation(ctx interface{}, request interface{}) *MockPostgresInterface_GetDatabaseOperation_Call { + return &MockPostgresInterface_GetDatabaseOperation_Call{Call: _e.mock.On("GetDatabaseOperation", ctx, request)} +} + +func (_c *MockPostgresInterface_GetDatabaseOperation_Call) Run(run func(ctx context.Context, request postgres.GetOperationRequest)) *MockPostgresInterface_GetDatabaseOperation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetOperationRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseOperation_Call) Return(_a0 *postgres.Operation, _a1 error) *MockPostgresInterface_GetDatabaseOperation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseOperation_Call) RunAndReturn(run func(context.Context, postgres.GetOperationRequest) (*postgres.Operation, error)) *MockPostgresInterface_GetDatabaseOperation_Call { + _c.Call.Return(run) + return _c +} + +// GetDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) GetDatabaseProject(ctx context.Context, request postgres.GetDatabaseProjectRequest) (*postgres.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for GetDatabaseProject") + } + + var r0 *postgres.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseProjectRequest) (*postgres.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.GetDatabaseProjectRequest) *postgres.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.GetDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_GetDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDatabaseProject' +type MockPostgresInterface_GetDatabaseProject_Call struct { + *mock.Call +} + +// GetDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.GetDatabaseProjectRequest +func (_e *MockPostgresInterface_Expecter) GetDatabaseProject(ctx interface{}, request interface{}) *MockPostgresInterface_GetDatabaseProject_Call { + return &MockPostgresInterface_GetDatabaseProject_Call{Call: _e.mock.On("GetDatabaseProject", ctx, request)} +} + +func (_c *MockPostgresInterface_GetDatabaseProject_Call) Run(run func(ctx context.Context, request postgres.GetDatabaseProjectRequest)) *MockPostgresInterface_GetDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.GetDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseProject_Call) Return(_a0 *postgres.DatabaseProject, _a1 error) *MockPostgresInterface_GetDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_GetDatabaseProject_Call) RunAndReturn(run func(context.Context, postgres.GetDatabaseProjectRequest) (*postgres.DatabaseProject, error)) *MockPostgresInterface_GetDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranches provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseBranches(ctx context.Context, request postgres.ListDatabaseBranchesRequest) listing.Iterator[postgres.DatabaseBranch] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranches") + } + + var r0 listing.Iterator[postgres.DatabaseBranch] + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseBranchesRequest) listing.Iterator[postgres.DatabaseBranch]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[postgres.DatabaseBranch]) + } + } + + return r0 +} + +// MockPostgresInterface_ListDatabaseBranches_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranches' +type MockPostgresInterface_ListDatabaseBranches_Call struct { + *mock.Call +} + +// ListDatabaseBranches is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseBranchesRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseBranches(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseBranches_Call { + return &MockPostgresInterface_ListDatabaseBranches_Call{Call: _e.mock.On("ListDatabaseBranches", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseBranches_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseBranchesRequest)) *MockPostgresInterface_ListDatabaseBranches_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseBranches_Call) Return(_a0 listing.Iterator[postgres.DatabaseBranch]) *MockPostgresInterface_ListDatabaseBranches_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseBranches_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseBranchesRequest) listing.Iterator[postgres.DatabaseBranch]) *MockPostgresInterface_ListDatabaseBranches_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseBranchesAll provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseBranchesAll(ctx context.Context, request postgres.ListDatabaseBranchesRequest) ([]postgres.DatabaseBranch, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseBranchesAll") + } + + var r0 []postgres.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseBranchesRequest) ([]postgres.DatabaseBranch, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseBranchesRequest) []postgres.DatabaseBranch); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]postgres.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.ListDatabaseBranchesRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_ListDatabaseBranchesAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseBranchesAll' +type MockPostgresInterface_ListDatabaseBranchesAll_Call struct { + *mock.Call +} + +// ListDatabaseBranchesAll is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseBranchesRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseBranchesAll(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseBranchesAll_Call { + return &MockPostgresInterface_ListDatabaseBranchesAll_Call{Call: _e.mock.On("ListDatabaseBranchesAll", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseBranchesAll_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseBranchesRequest)) *MockPostgresInterface_ListDatabaseBranchesAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseBranchesRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseBranchesAll_Call) Return(_a0 []postgres.DatabaseBranch, _a1 error) *MockPostgresInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseBranchesAll_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseBranchesRequest) ([]postgres.DatabaseBranch, error)) *MockPostgresInterface_ListDatabaseBranchesAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpoints provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseEndpoints(ctx context.Context, request postgres.ListDatabaseEndpointsRequest) listing.Iterator[postgres.DatabaseEndpoint] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpoints") + } + + var r0 listing.Iterator[postgres.DatabaseEndpoint] + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseEndpointsRequest) listing.Iterator[postgres.DatabaseEndpoint]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[postgres.DatabaseEndpoint]) + } + } + + return r0 +} + +// MockPostgresInterface_ListDatabaseEndpoints_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpoints' +type MockPostgresInterface_ListDatabaseEndpoints_Call struct { + *mock.Call +} + +// ListDatabaseEndpoints is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseEndpointsRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseEndpoints(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseEndpoints_Call { + return &MockPostgresInterface_ListDatabaseEndpoints_Call{Call: _e.mock.On("ListDatabaseEndpoints", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseEndpoints_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseEndpointsRequest)) *MockPostgresInterface_ListDatabaseEndpoints_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseEndpoints_Call) Return(_a0 listing.Iterator[postgres.DatabaseEndpoint]) *MockPostgresInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseEndpoints_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseEndpointsRequest) listing.Iterator[postgres.DatabaseEndpoint]) *MockPostgresInterface_ListDatabaseEndpoints_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseEndpointsAll provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseEndpointsAll(ctx context.Context, request postgres.ListDatabaseEndpointsRequest) ([]postgres.DatabaseEndpoint, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseEndpointsAll") + } + + var r0 []postgres.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseEndpointsRequest) ([]postgres.DatabaseEndpoint, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseEndpointsRequest) []postgres.DatabaseEndpoint); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]postgres.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.ListDatabaseEndpointsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_ListDatabaseEndpointsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseEndpointsAll' +type MockPostgresInterface_ListDatabaseEndpointsAll_Call struct { + *mock.Call +} + +// ListDatabaseEndpointsAll is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseEndpointsRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseEndpointsAll(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseEndpointsAll_Call { + return &MockPostgresInterface_ListDatabaseEndpointsAll_Call{Call: _e.mock.On("ListDatabaseEndpointsAll", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseEndpointsAll_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseEndpointsRequest)) *MockPostgresInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseEndpointsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseEndpointsAll_Call) Return(_a0 []postgres.DatabaseEndpoint, _a1 error) *MockPostgresInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseEndpointsAll_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseEndpointsRequest) ([]postgres.DatabaseEndpoint, error)) *MockPostgresInterface_ListDatabaseEndpointsAll_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjects provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseProjects(ctx context.Context, request postgres.ListDatabaseProjectsRequest) listing.Iterator[postgres.DatabaseProject] { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjects") + } + + var r0 listing.Iterator[postgres.DatabaseProject] + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseProjectsRequest) listing.Iterator[postgres.DatabaseProject]); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(listing.Iterator[postgres.DatabaseProject]) + } + } + + return r0 +} + +// MockPostgresInterface_ListDatabaseProjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjects' +type MockPostgresInterface_ListDatabaseProjects_Call struct { + *mock.Call +} + +// ListDatabaseProjects is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseProjectsRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseProjects(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseProjects_Call { + return &MockPostgresInterface_ListDatabaseProjects_Call{Call: _e.mock.On("ListDatabaseProjects", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseProjects_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseProjectsRequest)) *MockPostgresInterface_ListDatabaseProjects_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseProjects_Call) Return(_a0 listing.Iterator[postgres.DatabaseProject]) *MockPostgresInterface_ListDatabaseProjects_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseProjects_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseProjectsRequest) listing.Iterator[postgres.DatabaseProject]) *MockPostgresInterface_ListDatabaseProjects_Call { + _c.Call.Return(run) + return _c +} + +// ListDatabaseProjectsAll provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) ListDatabaseProjectsAll(ctx context.Context, request postgres.ListDatabaseProjectsRequest) ([]postgres.DatabaseProject, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for ListDatabaseProjectsAll") + } + + var r0 []postgres.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseProjectsRequest) ([]postgres.DatabaseProject, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.ListDatabaseProjectsRequest) []postgres.DatabaseProject); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]postgres.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.ListDatabaseProjectsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_ListDatabaseProjectsAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseProjectsAll' +type MockPostgresInterface_ListDatabaseProjectsAll_Call struct { + *mock.Call +} + +// ListDatabaseProjectsAll is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.ListDatabaseProjectsRequest +func (_e *MockPostgresInterface_Expecter) ListDatabaseProjectsAll(ctx interface{}, request interface{}) *MockPostgresInterface_ListDatabaseProjectsAll_Call { + return &MockPostgresInterface_ListDatabaseProjectsAll_Call{Call: _e.mock.On("ListDatabaseProjectsAll", ctx, request)} +} + +func (_c *MockPostgresInterface_ListDatabaseProjectsAll_Call) Run(run func(ctx context.Context, request postgres.ListDatabaseProjectsRequest)) *MockPostgresInterface_ListDatabaseProjectsAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.ListDatabaseProjectsRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseProjectsAll_Call) Return(_a0 []postgres.DatabaseProject, _a1 error) *MockPostgresInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_ListDatabaseProjectsAll_Call) RunAndReturn(run func(context.Context, postgres.ListDatabaseProjectsRequest) ([]postgres.DatabaseProject, error)) *MockPostgresInterface_ListDatabaseProjectsAll_Call { + _c.Call.Return(run) + return _c +} + +// RestartDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) RestartDatabaseEndpoint(ctx context.Context, request postgres.RestartDatabaseEndpointRequest) (postgres.RestartDatabaseEndpointOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RestartDatabaseEndpoint") + } + + var r0 postgres.RestartDatabaseEndpointOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.RestartDatabaseEndpointRequest) (postgres.RestartDatabaseEndpointOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.RestartDatabaseEndpointRequest) postgres.RestartDatabaseEndpointOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.RestartDatabaseEndpointOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.RestartDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_RestartDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestartDatabaseEndpoint' +type MockPostgresInterface_RestartDatabaseEndpoint_Call struct { + *mock.Call +} + +// RestartDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.RestartDatabaseEndpointRequest +func (_e *MockPostgresInterface_Expecter) RestartDatabaseEndpoint(ctx interface{}, request interface{}) *MockPostgresInterface_RestartDatabaseEndpoint_Call { + return &MockPostgresInterface_RestartDatabaseEndpoint_Call{Call: _e.mock.On("RestartDatabaseEndpoint", ctx, request)} +} + +func (_c *MockPostgresInterface_RestartDatabaseEndpoint_Call) Run(run func(ctx context.Context, request postgres.RestartDatabaseEndpointRequest)) *MockPostgresInterface_RestartDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.RestartDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_RestartDatabaseEndpoint_Call) Return(_a0 postgres.RestartDatabaseEndpointOperationInterface, _a1 error) *MockPostgresInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_RestartDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, postgres.RestartDatabaseEndpointRequest) (postgres.RestartDatabaseEndpointOperationInterface, error)) *MockPostgresInterface_RestartDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseBranch provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) UpdateDatabaseBranch(ctx context.Context, request postgres.UpdateDatabaseBranchRequest) (postgres.UpdateDatabaseBranchOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseBranch") + } + + var r0 postgres.UpdateDatabaseBranchOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseBranchRequest) (postgres.UpdateDatabaseBranchOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseBranchRequest) postgres.UpdateDatabaseBranchOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.UpdateDatabaseBranchOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.UpdateDatabaseBranchRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_UpdateDatabaseBranch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseBranch' +type MockPostgresInterface_UpdateDatabaseBranch_Call struct { + *mock.Call +} + +// UpdateDatabaseBranch is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.UpdateDatabaseBranchRequest +func (_e *MockPostgresInterface_Expecter) UpdateDatabaseBranch(ctx interface{}, request interface{}) *MockPostgresInterface_UpdateDatabaseBranch_Call { + return &MockPostgresInterface_UpdateDatabaseBranch_Call{Call: _e.mock.On("UpdateDatabaseBranch", ctx, request)} +} + +func (_c *MockPostgresInterface_UpdateDatabaseBranch_Call) Run(run func(ctx context.Context, request postgres.UpdateDatabaseBranchRequest)) *MockPostgresInterface_UpdateDatabaseBranch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.UpdateDatabaseBranchRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseBranch_Call) Return(_a0 postgres.UpdateDatabaseBranchOperationInterface, _a1 error) *MockPostgresInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseBranch_Call) RunAndReturn(run func(context.Context, postgres.UpdateDatabaseBranchRequest) (postgres.UpdateDatabaseBranchOperationInterface, error)) *MockPostgresInterface_UpdateDatabaseBranch_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseEndpoint provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) UpdateDatabaseEndpoint(ctx context.Context, request postgres.UpdateDatabaseEndpointRequest) (postgres.UpdateDatabaseEndpointOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseEndpoint") + } + + var r0 postgres.UpdateDatabaseEndpointOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseEndpointRequest) (postgres.UpdateDatabaseEndpointOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseEndpointRequest) postgres.UpdateDatabaseEndpointOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.UpdateDatabaseEndpointOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.UpdateDatabaseEndpointRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_UpdateDatabaseEndpoint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseEndpoint' +type MockPostgresInterface_UpdateDatabaseEndpoint_Call struct { + *mock.Call +} + +// UpdateDatabaseEndpoint is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.UpdateDatabaseEndpointRequest +func (_e *MockPostgresInterface_Expecter) UpdateDatabaseEndpoint(ctx interface{}, request interface{}) *MockPostgresInterface_UpdateDatabaseEndpoint_Call { + return &MockPostgresInterface_UpdateDatabaseEndpoint_Call{Call: _e.mock.On("UpdateDatabaseEndpoint", ctx, request)} +} + +func (_c *MockPostgresInterface_UpdateDatabaseEndpoint_Call) Run(run func(ctx context.Context, request postgres.UpdateDatabaseEndpointRequest)) *MockPostgresInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.UpdateDatabaseEndpointRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseEndpoint_Call) Return(_a0 postgres.UpdateDatabaseEndpointOperationInterface, _a1 error) *MockPostgresInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseEndpoint_Call) RunAndReturn(run func(context.Context, postgres.UpdateDatabaseEndpointRequest) (postgres.UpdateDatabaseEndpointOperationInterface, error)) *MockPostgresInterface_UpdateDatabaseEndpoint_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDatabaseProject provides a mock function with given fields: ctx, request +func (_m *MockPostgresInterface) UpdateDatabaseProject(ctx context.Context, request postgres.UpdateDatabaseProjectRequest) (postgres.UpdateDatabaseProjectOperationInterface, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for UpdateDatabaseProject") + } + + var r0 postgres.UpdateDatabaseProjectOperationInterface + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseProjectRequest) (postgres.UpdateDatabaseProjectOperationInterface, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, postgres.UpdateDatabaseProjectRequest) postgres.UpdateDatabaseProjectOperationInterface); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(postgres.UpdateDatabaseProjectOperationInterface) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, postgres.UpdateDatabaseProjectRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPostgresInterface_UpdateDatabaseProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDatabaseProject' +type MockPostgresInterface_UpdateDatabaseProject_Call struct { + *mock.Call +} + +// UpdateDatabaseProject is a helper method to define mock.On call +// - ctx context.Context +// - request postgres.UpdateDatabaseProjectRequest +func (_e *MockPostgresInterface_Expecter) UpdateDatabaseProject(ctx interface{}, request interface{}) *MockPostgresInterface_UpdateDatabaseProject_Call { + return &MockPostgresInterface_UpdateDatabaseProject_Call{Call: _e.mock.On("UpdateDatabaseProject", ctx, request)} +} + +func (_c *MockPostgresInterface_UpdateDatabaseProject_Call) Run(run func(ctx context.Context, request postgres.UpdateDatabaseProjectRequest)) *MockPostgresInterface_UpdateDatabaseProject_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(postgres.UpdateDatabaseProjectRequest)) + }) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseProject_Call) Return(_a0 postgres.UpdateDatabaseProjectOperationInterface, _a1 error) *MockPostgresInterface_UpdateDatabaseProject_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPostgresInterface_UpdateDatabaseProject_Call) RunAndReturn(run func(context.Context, postgres.UpdateDatabaseProjectRequest) (postgres.UpdateDatabaseProjectOperationInterface, error)) *MockPostgresInterface_UpdateDatabaseProject_Call { + _c.Call.Return(run) + return _c +} + +// NewMockPostgresInterface creates a new instance of MockPostgresInterface. 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 NewMockPostgresInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPostgresInterface { + mock := &MockPostgresInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_restart_database_endpoint_operation_interface.go b/experimental/mocks/service/postgres/mock_restart_database_endpoint_operation_interface.go new file mode 100644 index 000000000..ddb105cf6 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_restart_database_endpoint_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockRestartDatabaseEndpointOperationInterface is an autogenerated mock type for the RestartDatabaseEndpointOperationInterface type +type MockRestartDatabaseEndpointOperationInterface struct { + mock.Mock +} + +type MockRestartDatabaseEndpointOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockRestartDatabaseEndpointOperationInterface) EXPECT() *MockRestartDatabaseEndpointOperationInterface_Expecter { + return &MockRestartDatabaseEndpointOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockRestartDatabaseEndpointOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestartDatabaseEndpointOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockRestartDatabaseEndpointOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockRestartDatabaseEndpointOperationInterface_Expecter) Done() *MockRestartDatabaseEndpointOperationInterface_Done_Call { + return &MockRestartDatabaseEndpointOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Done_Call) Run(run func()) *MockRestartDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockRestartDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockRestartDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockRestartDatabaseEndpointOperationInterface) Metadata() (*postgres.DatabaseEndpointOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseEndpointOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseEndpointOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseEndpointOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpointOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestartDatabaseEndpointOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockRestartDatabaseEndpointOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockRestartDatabaseEndpointOperationInterface_Expecter) Metadata() *MockRestartDatabaseEndpointOperationInterface_Metadata_Call { + return &MockRestartDatabaseEndpointOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Metadata_Call) Run(run func()) *MockRestartDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseEndpointOperationMetadata, _a1 error) *MockRestartDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseEndpointOperationMetadata, error)) *MockRestartDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockRestartDatabaseEndpointOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockRestartDatabaseEndpointOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockRestartDatabaseEndpointOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockRestartDatabaseEndpointOperationInterface_Expecter) Name() *MockRestartDatabaseEndpointOperationInterface_Name_Call { + return &MockRestartDatabaseEndpointOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Name_Call) Run(run func()) *MockRestartDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Name_Call) Return(_a0 string) *MockRestartDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Name_Call) RunAndReturn(run func() string) *MockRestartDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockRestartDatabaseEndpointOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseEndpoint, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseEndpoint); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRestartDatabaseEndpointOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockRestartDatabaseEndpointOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockRestartDatabaseEndpointOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockRestartDatabaseEndpointOperationInterface_Wait_Call { + return &MockRestartDatabaseEndpointOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockRestartDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseEndpoint, _a1 error) *MockRestartDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRestartDatabaseEndpointOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)) *MockRestartDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockRestartDatabaseEndpointOperationInterface creates a new instance of MockRestartDatabaseEndpointOperationInterface. 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 NewMockRestartDatabaseEndpointOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockRestartDatabaseEndpointOperationInterface { + mock := &MockRestartDatabaseEndpointOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_update_database_branch_operation_interface.go b/experimental/mocks/service/postgres/mock_update_database_branch_operation_interface.go new file mode 100644 index 000000000..524a57e91 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_update_database_branch_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockUpdateDatabaseBranchOperationInterface is an autogenerated mock type for the UpdateDatabaseBranchOperationInterface type +type MockUpdateDatabaseBranchOperationInterface struct { + mock.Mock +} + +type MockUpdateDatabaseBranchOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUpdateDatabaseBranchOperationInterface) EXPECT() *MockUpdateDatabaseBranchOperationInterface_Expecter { + return &MockUpdateDatabaseBranchOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockUpdateDatabaseBranchOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseBranchOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockUpdateDatabaseBranchOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockUpdateDatabaseBranchOperationInterface_Expecter) Done() *MockUpdateDatabaseBranchOperationInterface_Done_Call { + return &MockUpdateDatabaseBranchOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Done_Call) Run(run func()) *MockUpdateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockUpdateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockUpdateDatabaseBranchOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockUpdateDatabaseBranchOperationInterface) Metadata() (*postgres.DatabaseBranchOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseBranchOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseBranchOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseBranchOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseBranchOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseBranchOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockUpdateDatabaseBranchOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockUpdateDatabaseBranchOperationInterface_Expecter) Metadata() *MockUpdateDatabaseBranchOperationInterface_Metadata_Call { + return &MockUpdateDatabaseBranchOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Metadata_Call) Run(run func()) *MockUpdateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseBranchOperationMetadata, _a1 error) *MockUpdateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseBranchOperationMetadata, error)) *MockUpdateDatabaseBranchOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockUpdateDatabaseBranchOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockUpdateDatabaseBranchOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockUpdateDatabaseBranchOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockUpdateDatabaseBranchOperationInterface_Expecter) Name() *MockUpdateDatabaseBranchOperationInterface_Name_Call { + return &MockUpdateDatabaseBranchOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Name_Call) Run(run func()) *MockUpdateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Name_Call) Return(_a0 string) *MockUpdateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Name_Call) RunAndReturn(run func() string) *MockUpdateDatabaseBranchOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockUpdateDatabaseBranchOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseBranch, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseBranch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseBranch, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseBranch); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseBranch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseBranchOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockUpdateDatabaseBranchOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockUpdateDatabaseBranchOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockUpdateDatabaseBranchOperationInterface_Wait_Call { + return &MockUpdateDatabaseBranchOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockUpdateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseBranch, _a1 error) *MockUpdateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseBranchOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseBranch, error)) *MockUpdateDatabaseBranchOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockUpdateDatabaseBranchOperationInterface creates a new instance of MockUpdateDatabaseBranchOperationInterface. 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 NewMockUpdateDatabaseBranchOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUpdateDatabaseBranchOperationInterface { + mock := &MockUpdateDatabaseBranchOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_update_database_endpoint_operation_interface.go b/experimental/mocks/service/postgres/mock_update_database_endpoint_operation_interface.go new file mode 100644 index 000000000..0e2f1c7c8 --- /dev/null +++ b/experimental/mocks/service/postgres/mock_update_database_endpoint_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockUpdateDatabaseEndpointOperationInterface is an autogenerated mock type for the UpdateDatabaseEndpointOperationInterface type +type MockUpdateDatabaseEndpointOperationInterface struct { + mock.Mock +} + +type MockUpdateDatabaseEndpointOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUpdateDatabaseEndpointOperationInterface) EXPECT() *MockUpdateDatabaseEndpointOperationInterface_Expecter { + return &MockUpdateDatabaseEndpointOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockUpdateDatabaseEndpointOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseEndpointOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockUpdateDatabaseEndpointOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockUpdateDatabaseEndpointOperationInterface_Expecter) Done() *MockUpdateDatabaseEndpointOperationInterface_Done_Call { + return &MockUpdateDatabaseEndpointOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Done_Call) Run(run func()) *MockUpdateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockUpdateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockUpdateDatabaseEndpointOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockUpdateDatabaseEndpointOperationInterface) Metadata() (*postgres.DatabaseEndpointOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseEndpointOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseEndpointOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseEndpointOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpointOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseEndpointOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockUpdateDatabaseEndpointOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockUpdateDatabaseEndpointOperationInterface_Expecter) Metadata() *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call { + return &MockUpdateDatabaseEndpointOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call) Run(run func()) *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseEndpointOperationMetadata, _a1 error) *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseEndpointOperationMetadata, error)) *MockUpdateDatabaseEndpointOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockUpdateDatabaseEndpointOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockUpdateDatabaseEndpointOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockUpdateDatabaseEndpointOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockUpdateDatabaseEndpointOperationInterface_Expecter) Name() *MockUpdateDatabaseEndpointOperationInterface_Name_Call { + return &MockUpdateDatabaseEndpointOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Name_Call) Run(run func()) *MockUpdateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Name_Call) Return(_a0 string) *MockUpdateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Name_Call) RunAndReturn(run func() string) *MockUpdateDatabaseEndpointOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockUpdateDatabaseEndpointOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseEndpoint, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseEndpoint + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseEndpoint); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseEndpoint) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseEndpointOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockUpdateDatabaseEndpointOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockUpdateDatabaseEndpointOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockUpdateDatabaseEndpointOperationInterface_Wait_Call { + return &MockUpdateDatabaseEndpointOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockUpdateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseEndpoint, _a1 error) *MockUpdateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseEndpointOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseEndpoint, error)) *MockUpdateDatabaseEndpointOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockUpdateDatabaseEndpointOperationInterface creates a new instance of MockUpdateDatabaseEndpointOperationInterface. 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 NewMockUpdateDatabaseEndpointOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUpdateDatabaseEndpointOperationInterface { + mock := &MockUpdateDatabaseEndpointOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/postgres/mock_update_database_project_operation_interface.go b/experimental/mocks/service/postgres/mock_update_database_project_operation_interface.go new file mode 100644 index 000000000..e674150bf --- /dev/null +++ b/experimental/mocks/service/postgres/mock_update_database_project_operation_interface.go @@ -0,0 +1,255 @@ +// Code generated by mockery v2.53.2. DO NOT EDIT. + +package postgres + +import ( + context "context" + + lro "github.com/databricks/databricks-sdk-go/service/common/lro" + mock "github.com/stretchr/testify/mock" + + postgres "github.com/databricks/databricks-sdk-go/service/postgres" +) + +// MockUpdateDatabaseProjectOperationInterface is an autogenerated mock type for the UpdateDatabaseProjectOperationInterface type +type MockUpdateDatabaseProjectOperationInterface struct { + mock.Mock +} + +type MockUpdateDatabaseProjectOperationInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockUpdateDatabaseProjectOperationInterface) EXPECT() *MockUpdateDatabaseProjectOperationInterface_Expecter { + return &MockUpdateDatabaseProjectOperationInterface_Expecter{mock: &_m.Mock} +} + +// Done provides a mock function with no fields +func (_m *MockUpdateDatabaseProjectOperationInterface) Done() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Done") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseProjectOperationInterface_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type MockUpdateDatabaseProjectOperationInterface_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *MockUpdateDatabaseProjectOperationInterface_Expecter) Done() *MockUpdateDatabaseProjectOperationInterface_Done_Call { + return &MockUpdateDatabaseProjectOperationInterface_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Done_Call) Run(run func()) *MockUpdateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Done_Call) Return(_a0 bool, _a1 error) *MockUpdateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Done_Call) RunAndReturn(run func() (bool, error)) *MockUpdateDatabaseProjectOperationInterface_Done_Call { + _c.Call.Return(run) + return _c +} + +// Metadata provides a mock function with no fields +func (_m *MockUpdateDatabaseProjectOperationInterface) Metadata() (*postgres.DatabaseProjectOperationMetadata, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Metadata") + } + + var r0 *postgres.DatabaseProjectOperationMetadata + var r1 error + if rf, ok := ret.Get(0).(func() (*postgres.DatabaseProjectOperationMetadata, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *postgres.DatabaseProjectOperationMetadata); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseProjectOperationMetadata) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseProjectOperationInterface_Metadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Metadata' +type MockUpdateDatabaseProjectOperationInterface_Metadata_Call struct { + *mock.Call +} + +// Metadata is a helper method to define mock.On call +func (_e *MockUpdateDatabaseProjectOperationInterface_Expecter) Metadata() *MockUpdateDatabaseProjectOperationInterface_Metadata_Call { + return &MockUpdateDatabaseProjectOperationInterface_Metadata_Call{Call: _e.mock.On("Metadata")} +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Metadata_Call) Run(run func()) *MockUpdateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Metadata_Call) Return(_a0 *postgres.DatabaseProjectOperationMetadata, _a1 error) *MockUpdateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Metadata_Call) RunAndReturn(run func() (*postgres.DatabaseProjectOperationMetadata, error)) *MockUpdateDatabaseProjectOperationInterface_Metadata_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with no fields +func (_m *MockUpdateDatabaseProjectOperationInterface) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// MockUpdateDatabaseProjectOperationInterface_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockUpdateDatabaseProjectOperationInterface_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockUpdateDatabaseProjectOperationInterface_Expecter) Name() *MockUpdateDatabaseProjectOperationInterface_Name_Call { + return &MockUpdateDatabaseProjectOperationInterface_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Name_Call) Run(run func()) *MockUpdateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Name_Call) Return(_a0 string) *MockUpdateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Name_Call) RunAndReturn(run func() string) *MockUpdateDatabaseProjectOperationInterface_Name_Call { + _c.Call.Return(run) + return _c +} + +// Wait provides a mock function with given fields: ctx, opts +func (_m *MockUpdateDatabaseProjectOperationInterface) Wait(ctx context.Context, opts *lro.LroOptions) (*postgres.DatabaseProject, error) { + ret := _m.Called(ctx, opts) + + if len(ret) == 0 { + panic("no return value specified for Wait") + } + + var r0 *postgres.DatabaseProject + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) (*postgres.DatabaseProject, error)); ok { + return rf(ctx, opts) + } + if rf, ok := ret.Get(0).(func(context.Context, *lro.LroOptions) *postgres.DatabaseProject); ok { + r0 = rf(ctx, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*postgres.DatabaseProject) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *lro.LroOptions) error); ok { + r1 = rf(ctx, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockUpdateDatabaseProjectOperationInterface_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait' +type MockUpdateDatabaseProjectOperationInterface_Wait_Call struct { + *mock.Call +} + +// Wait is a helper method to define mock.On call +// - ctx context.Context +// - opts *lro.LroOptions +func (_e *MockUpdateDatabaseProjectOperationInterface_Expecter) Wait(ctx interface{}, opts interface{}) *MockUpdateDatabaseProjectOperationInterface_Wait_Call { + return &MockUpdateDatabaseProjectOperationInterface_Wait_Call{Call: _e.mock.On("Wait", ctx, opts)} +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Wait_Call) Run(run func(ctx context.Context, opts *lro.LroOptions)) *MockUpdateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*lro.LroOptions)) + }) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Wait_Call) Return(_a0 *postgres.DatabaseProject, _a1 error) *MockUpdateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockUpdateDatabaseProjectOperationInterface_Wait_Call) RunAndReturn(run func(context.Context, *lro.LroOptions) (*postgres.DatabaseProject, error)) *MockUpdateDatabaseProjectOperationInterface_Wait_Call { + _c.Call.Return(run) + return _c +} + +// NewMockUpdateDatabaseProjectOperationInterface creates a new instance of MockUpdateDatabaseProjectOperationInterface. 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 NewMockUpdateDatabaseProjectOperationInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockUpdateDatabaseProjectOperationInterface { + mock := &MockUpdateDatabaseProjectOperationInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go b/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go index b2466533e..878c069bf 100644 --- a/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go +++ b/experimental/mocks/service/sharing/mock_recipient_federation_policies_interface.go @@ -464,6 +464,65 @@ func (_c *MockRecipientFederationPoliciesInterface_ListByRecipientName_Call) Run return _c } +// Update provides a mock function with given fields: ctx, request +func (_m *MockRecipientFederationPoliciesInterface) Update(ctx context.Context, request sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *sharing.FederationPolicy + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, sharing.UpdateFederationPolicyRequest) *sharing.FederationPolicy); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sharing.FederationPolicy) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, sharing.UpdateFederationPolicyRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockRecipientFederationPoliciesInterface_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockRecipientFederationPoliciesInterface_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - request sharing.UpdateFederationPolicyRequest +func (_e *MockRecipientFederationPoliciesInterface_Expecter) Update(ctx interface{}, request interface{}) *MockRecipientFederationPoliciesInterface_Update_Call { + return &MockRecipientFederationPoliciesInterface_Update_Call{Call: _e.mock.On("Update", ctx, request)} +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) Run(run func(ctx context.Context, request sharing.UpdateFederationPolicyRequest)) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(sharing.UpdateFederationPolicyRequest)) + }) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) Return(_a0 *sharing.FederationPolicy, _a1 error) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockRecipientFederationPoliciesInterface_Update_Call) RunAndReturn(run func(context.Context, sharing.UpdateFederationPolicyRequest) (*sharing.FederationPolicy, error)) *MockRecipientFederationPoliciesInterface_Update_Call { + _c.Call.Return(run) + return _c +} + // NewMockRecipientFederationPoliciesInterface creates a new instance of MockRecipientFederationPoliciesInterface. 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 NewMockRecipientFederationPoliciesInterface(t interface { 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_endpoints_interface.go b/experimental/mocks/service/vectorsearch/mock_vector_search_endpoints_interface.go index 9cc2b4d0f..70d91d4f4 100644 --- a/experimental/mocks/service/vectorsearch/mock_vector_search_endpoints_interface.go +++ b/experimental/mocks/service/vectorsearch/mock_vector_search_endpoints_interface.go @@ -481,6 +481,124 @@ func (_c *MockVectorSearchEndpointsInterface_ListEndpointsAll_Call) RunAndReturn return _c } +// PatchEndpointThroughput provides a mock function with given fields: ctx, request +func (_m *MockVectorSearchEndpointsInterface) PatchEndpointThroughput(ctx context.Context, request vectorsearch.PatchEndpointThroughputRequest) (*vectorsearch.PatchEndpointThroughputResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for PatchEndpointThroughput") + } + + var r0 *vectorsearch.PatchEndpointThroughputResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.PatchEndpointThroughputRequest) (*vectorsearch.PatchEndpointThroughputResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.PatchEndpointThroughputRequest) *vectorsearch.PatchEndpointThroughputResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vectorsearch.PatchEndpointThroughputResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, vectorsearch.PatchEndpointThroughputRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchEndpointThroughput' +type MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call struct { + *mock.Call +} + +// PatchEndpointThroughput is a helper method to define mock.On call +// - ctx context.Context +// - request vectorsearch.PatchEndpointThroughputRequest +func (_e *MockVectorSearchEndpointsInterface_Expecter) PatchEndpointThroughput(ctx interface{}, request interface{}) *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call { + return &MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call{Call: _e.mock.On("PatchEndpointThroughput", ctx, request)} +} + +func (_c *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call) Run(run func(ctx context.Context, request vectorsearch.PatchEndpointThroughputRequest)) *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(vectorsearch.PatchEndpointThroughputRequest)) + }) + return _c +} + +func (_c *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call) Return(_a0 *vectorsearch.PatchEndpointThroughputResponse, _a1 error) *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call) RunAndReturn(run func(context.Context, vectorsearch.PatchEndpointThroughputRequest) (*vectorsearch.PatchEndpointThroughputResponse, error)) *MockVectorSearchEndpointsInterface_PatchEndpointThroughput_Call { + _c.Call.Return(run) + return _c +} + +// RetrieveUserVisibleMetrics provides a mock function with given fields: ctx, request +func (_m *MockVectorSearchEndpointsInterface) RetrieveUserVisibleMetrics(ctx context.Context, request vectorsearch.RetrieveUserVisibleMetricsRequest) (*vectorsearch.RetrieveUserVisibleMetricsResponse, error) { + ret := _m.Called(ctx, request) + + if len(ret) == 0 { + panic("no return value specified for RetrieveUserVisibleMetrics") + } + + var r0 *vectorsearch.RetrieveUserVisibleMetricsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.RetrieveUserVisibleMetricsRequest) (*vectorsearch.RetrieveUserVisibleMetricsResponse, error)); ok { + return rf(ctx, request) + } + if rf, ok := ret.Get(0).(func(context.Context, vectorsearch.RetrieveUserVisibleMetricsRequest) *vectorsearch.RetrieveUserVisibleMetricsResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*vectorsearch.RetrieveUserVisibleMetricsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, vectorsearch.RetrieveUserVisibleMetricsRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveUserVisibleMetrics' +type MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call struct { + *mock.Call +} + +// RetrieveUserVisibleMetrics is a helper method to define mock.On call +// - ctx context.Context +// - request vectorsearch.RetrieveUserVisibleMetricsRequest +func (_e *MockVectorSearchEndpointsInterface_Expecter) RetrieveUserVisibleMetrics(ctx interface{}, request interface{}) *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call { + return &MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call{Call: _e.mock.On("RetrieveUserVisibleMetrics", ctx, request)} +} + +func (_c *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call) Run(run func(ctx context.Context, request vectorsearch.RetrieveUserVisibleMetricsRequest)) *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(vectorsearch.RetrieveUserVisibleMetricsRequest)) + }) + return _c +} + +func (_c *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call) Return(_a0 *vectorsearch.RetrieveUserVisibleMetricsResponse, _a1 error) *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call) RunAndReturn(run func(context.Context, vectorsearch.RetrieveUserVisibleMetricsRequest) (*vectorsearch.RetrieveUserVisibleMetricsResponse, error)) *MockVectorSearchEndpointsInterface_RetrieveUserVisibleMetrics_Call { + _c.Call.Return(run) + return _c +} + // UpdateEndpointBudgetPolicy provides a mock function with given fields: ctx, request func (_m *MockVectorSearchEndpointsInterface) UpdateEndpointBudgetPolicy(ctx context.Context, request vectorsearch.PatchEndpointBudgetPolicyRequest) (*vectorsearch.PatchEndpointBudgetPolicyResponse, error) { ret := _m.Called(ctx, request) 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/json_marshall_test.go b/internal/generatedtests/json_marshall_test.go index 996934e0e..eb0c39618 100755 --- a/internal/generatedtests/json_marshall_test.go +++ b/internal/generatedtests/json_marshall_test.go @@ -204,7 +204,7 @@ func TestJsonMarshall(t *testing.T) { RequiredString: "non_default_string", RequiredStruct: map[string]json.RawMessage{}, RequiredTimestamp: *time.New(timeFromString("2023-12-31T23:59:59Z")), - RequiredValue: json.RawMessage("{}"), + RequiredValue: json.RawMessage("{\"key\": \"value\"}"), TestRequiredEnum: jsonmarshallv2.TestEnumTestEnumTwo, }, want: `{ @@ -212,7 +212,7 @@ func TestJsonMarshall(t *testing.T) { "required_int32": 42, "required_int64": 1234567890123456789, "required_bool": true, - "required_value": {}, + "required_value": {"key": "value"}, "required_list_value": [], "required_struct": {}, "required_message": {}, diff --git a/internal/generatedtests/lro_call_test.go b/internal/generatedtests/lro_call_test.go index 1d5e0d9ea..aec12614e 100755 --- a/internal/generatedtests/lro_call_test.go +++ b/internal/generatedtests/lro_call_test.go @@ -8,9 +8,9 @@ import ( "time" "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/experimental/api" "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" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" ) @@ -94,7 +94,7 @@ func TestLRO_CreateTestResource_Wait(t *testing.T) { if err != nil { t.Fatalf("CreateTestResource failed: %v", err) } - result, err := lroOp.Wait(ctx, &lro.LroOptions{Timeout: 1 * time.Minute}) + result, err := lroOp.Wait(ctx, api.WithTimeout(1*time.Minute)) if diff := cmp.Diff(tt.wantResult, result, cmpopts.IgnoreFields(lrotesting.TestResource{}, "ForceSendFields")); diff != "" { t.Errorf("result mismatch (-expected +actual):\n%s", diff) } diff --git a/internal/testspecs/service/lrotesting/api.go b/internal/testspecs/service/lrotesting/api.go index cfd8fd1ea..6dcbd588d 100755 --- a/internal/testspecs/service/lrotesting/api.go +++ b/internal/testspecs/service/lrotesting/api.go @@ -6,12 +6,11 @@ package lrotesting import ( "context" "encoding/json" + "errors" "fmt" - "time" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/retries" - "github.com/databricks/databricks-sdk-go/service/common/lro" + "github.com/databricks/databricks-sdk-go/experimental/api" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -46,18 +45,19 @@ func (a *LroTestingAPI) CreateTestResource(ctx context.Context, request CreateTe if err != nil { return nil, err } - return &CreateTestResourceOperation{ + return &createTestResourceOperation{ impl: &a.lroTestingImpl, operation: operation, }, nil } type CreateTestResourceOperationInterface interface { - // Wait blocks until the long-running operation is completed with default 20 min - // timeout, the timeout can be overridden in the opts. If the operation didn't - // finished within the timeout, this function will through an error of type - // ErrTimedOut, otherwise successful response and any errors encountered. - Wait(ctx context.Context, opts *lro.LroOptions) (*TestResource, error) + + // Wait blocks until the long-running operation is completed. If no timeout is + // specified, this will poll indefinitely. If a timeout is provided and the operation + // didn't finish within the timeout, this function will return an error, otherwise + // returns successful response and any errors encountered. + Wait(ctx context.Context, opts ...api.Option) (*TestResource, error) // Starts asynchronous cancellation on a long-running operation. The server // makes a best effort to cancel the operation, but success is not guaranteed. @@ -75,35 +75,33 @@ type CreateTestResourceOperationInterface interface { Done() (bool, error) } -type CreateTestResourceOperation struct { +type createTestResourceOperation struct { impl *lroTestingImpl operation *Operation } -// Wait blocks until the long-running operation is completed with default 20 min -// timeout, the timeout can be overridden in the opts. If the operation didn't -// finished within the timeout, this function will through an error of type -// ErrTimedOut, otherwise successful response and any errors encountered. -func (a *CreateTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*TestResource, error) { - timeout := 20 * time.Minute // default timeout per LRO spec - if opts != nil && opts.Timeout > 0 { - timeout = opts.Timeout - } - +// Wait blocks until the long-running operation is completed. If no timeout is +// specified, this will poll indefinitely. If a timeout is provided and the operation +// didn't finish within the timeout, this function will return an error, otherwise +// returns successful response and any errors encountered. +func (a *createTestResourceOperation) Wait(ctx context.Context, opts ...api.Option) (*TestResource, error) { ctx = useragent.InContext(ctx, "sdk-feature", "long-running") - val, err := retries.Poll[TestResource](ctx, timeout, func() (*TestResource, *retries.Err) { + + errOperationInProgress := errors.New("operation still in progress") + var result *TestResource + call := func(ctx context.Context) error { operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ Name: a.operation.Name, }) if err != nil { - return nil, retries.Halt(err) + return err } // Update local operation state a.operation = operation if !operation.Done { - return nil, retries.Continues("operation still in progress") + return errOperationInProgress } if operation.Error != nil { @@ -118,34 +116,48 @@ func (a *CreateTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOpt errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) } - return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + return fmt.Errorf("operation failed: %s", errorMsg) } // Operation completed successfully, unmarshal response if operation.Response == nil { - return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + return fmt.Errorf("operation completed but no response available") } var testResource TestResource err = json.Unmarshal(operation.Response, &testResource) if err != nil { - return nil, retries.Halt(fmt.Errorf("failed to unmarshal testResource response: %w", err)) + return fmt.Errorf("failed to unmarshal testResource response: %w", err) } - return &testResource, nil + result = &testResource + return nil + } + + // Create a retrier that retries on errOperationInProgress with exponential backoff. + retrier := api.RetryOn(api.BackoffPolicy{}, func(err error) bool { + return errors.Is(err, errOperationInProgress) }) + // Add default retrier. + defaultOpts := []api.Option{ + api.WithRetrier(func() api.Retrier { return retrier }), + } + allOpts := append(defaultOpts, opts...) + + err := api.Execute(ctx, call, allOpts...) + if err != nil { return nil, err } - return val, nil + return result, nil } // Starts asynchronous cancellation on a long-running operation. The server // makes a best effort to cancel the operation, but success is not guaranteed. -func (a *CreateTestResourceOperation) Cancel(ctx context.Context) error { +func (a *createTestResourceOperation) Cancel(ctx context.Context) error { return a.impl.CancelOperation(ctx, CancelOperationRequest{ Name: a.operation.Name, }) @@ -153,13 +165,13 @@ func (a *CreateTestResourceOperation) Cancel(ctx context.Context) error { // Name returns the name of the long-running operation. The name is assigned // by the server and is unique within the service from which the operation is created. -func (a *CreateTestResourceOperation) Name() string { +func (a *createTestResourceOperation) Name() string { return a.operation.Name } // Metadata returns metadata associated with the long-running operation. // If the metadata is not available, the returned metadata and error are both nil. -func (a *CreateTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { +func (a *createTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { if a.operation.Metadata == nil { return nil, nil } @@ -174,7 +186,7 @@ func (a *CreateTestResourceOperation) Metadata() (*TestResourceOperationMetadata } // Done reports whether the long-running operation has completed. -func (a *CreateTestResourceOperation) Done() (bool, error) { +func (a *createTestResourceOperation) Done() (bool, error) { // Refresh the operation state first operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ Name: a.operation.Name, @@ -194,18 +206,19 @@ func (a *LroTestingAPI) DeleteTestResource(ctx context.Context, request DeleteTe if err != nil { return nil, err } - return &DeleteTestResourceOperation{ + return &deleteTestResourceOperation{ impl: &a.lroTestingImpl, operation: operation, }, nil } type DeleteTestResourceOperationInterface interface { - // Wait blocks until the long-running operation is completed with default 20 min - // timeout, the timeout can be overridden in the opts. If the operation didn't - // finished within the timeout, this function will through an error of type - // ErrTimedOut, otherwise successful response and any errors encountered. - Wait(ctx context.Context, opts *lro.LroOptions) error + + // Wait blocks until the long-running operation is completed. If no timeout is + // specified, this will poll indefinitely. If a timeout is provided and the operation + // didn't finish within the timeout, this function will return an error, otherwise + // returns successful response and any errors encountered. + Wait(ctx context.Context, opts ...api.Option) error // Starts asynchronous cancellation on a long-running operation. The server // makes a best effort to cancel the operation, but success is not guaranteed. @@ -223,35 +236,33 @@ type DeleteTestResourceOperationInterface interface { Done() (bool, error) } -type DeleteTestResourceOperation struct { +type deleteTestResourceOperation struct { impl *lroTestingImpl operation *Operation } -// Wait blocks until the long-running operation is completed with default 20 min -// timeout, the timeout can be overridden in the opts. If the operation didn't -// finished within the timeout, this function will through an error of type -// ErrTimedOut, otherwise successful response and any errors encountered. -func (a *DeleteTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOptions) error { - timeout := 20 * time.Minute // default timeout per LRO spec - if opts != nil && opts.Timeout > 0 { - timeout = opts.Timeout - } - +// Wait blocks until the long-running operation is completed. If no timeout is +// specified, this will poll indefinitely. If a timeout is provided and the operation +// didn't finish within the timeout, this function will return an error, otherwise +// returns successful response and any errors encountered. +func (a *deleteTestResourceOperation) Wait(ctx context.Context, opts ...api.Option) error { ctx = useragent.InContext(ctx, "sdk-feature", "long-running") - _, err := retries.Poll[struct{}](ctx, timeout, func() (*struct{}, *retries.Err) { + + errOperationInProgress := errors.New("operation still in progress") + + call := func(ctx context.Context) error { operation, err := a.impl.GetOperation(ctx, GetOperationRequest{ Name: a.operation.Name, }) if err != nil { - return nil, retries.Halt(err) + return err } // Update local operation state a.operation = operation if !operation.Done { - return nil, retries.Continues("operation still in progress") + return errOperationInProgress } if operation.Error != nil { @@ -266,25 +277,37 @@ func (a *DeleteTestResourceOperation) Wait(ctx context.Context, opts *lro.LroOpt errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) } - return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + return fmt.Errorf("operation failed: %s", errorMsg) } // Operation completed successfully, unmarshal response if operation.Response == nil { - return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + return fmt.Errorf("operation completed but no response available") } - return &struct{}{}, nil + return nil + } + // Create a retrier that retries on errOperationInProgress with exponential backoff. + retrier := api.RetryOn(api.BackoffPolicy{}, func(err error) bool { + return errors.Is(err, errOperationInProgress) }) + // Add default retrier. + defaultOpts := []api.Option{ + api.WithRetrier(func() api.Retrier { return retrier }), + } + allOpts := append(defaultOpts, opts...) + + err := api.Execute(ctx, call, allOpts...) + return err } // Starts asynchronous cancellation on a long-running operation. The server // makes a best effort to cancel the operation, but success is not guaranteed. -func (a *DeleteTestResourceOperation) Cancel(ctx context.Context) error { +func (a *deleteTestResourceOperation) Cancel(ctx context.Context) error { return a.impl.CancelOperation(ctx, CancelOperationRequest{ Name: a.operation.Name, }) @@ -292,13 +315,13 @@ func (a *DeleteTestResourceOperation) Cancel(ctx context.Context) error { // Name returns the name of the long-running operation. The name is assigned // by the server and is unique within the service from which the operation is created. -func (a *DeleteTestResourceOperation) Name() string { +func (a *deleteTestResourceOperation) Name() string { return a.operation.Name } // Metadata returns metadata associated with the long-running operation. // If the metadata is not available, the returned metadata and error are both nil. -func (a *DeleteTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { +func (a *deleteTestResourceOperation) Metadata() (*TestResourceOperationMetadata, error) { if a.operation.Metadata == nil { return nil, nil } @@ -313,7 +336,7 @@ func (a *DeleteTestResourceOperation) Metadata() (*TestResourceOperationMetadata } // Done reports whether the long-running operation has completed. -func (a *DeleteTestResourceOperation) Done() (bool, error) { +func (a *deleteTestResourceOperation) Done() (bool, error) { // Refresh the operation state first operation, err := a.impl.GetOperation(context.Background(), GetOperationRequest{ Name: a.operation.Name, diff --git a/internal/testspecs/service/lrotesting/model.go b/internal/testspecs/service/lrotesting/model.go index 805c57808..34ef4fb41 100755 --- a/internal/testspecs/service/lrotesting/model.go +++ b/internal/testspecs/service/lrotesting/model.go @@ -19,12 +19,7 @@ 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. +// Databricks Error that is returned by all Databricks APIs. type DatabricksServiceExceptionWithDetailsProto struct { // @pbjson-skip Details []json.RawMessage `json:"details,omitempty"` @@ -350,24 +345,13 @@ type Operation struct { 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. + // Some services might not provide such metadata. 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`. + // The normal, successful response of the operation. Response json.RawMessage `json:"response,omitempty"` ForceSendFields []string `json:"-" url:"-"` diff --git a/service/apps/model.go b/service/apps/model.go index 3bc388448..472b2628a 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -24,6 +24,8 @@ type App struct { CreateTime string `json:"create_time,omitempty"` // The email of the user that created the app. Creator string `json:"creator,omitempty"` + + DefaultGitSource *GitSource `json:"default_git_source,omitempty"` // The default workspace file system path of the source code from which app // deployment are created. This field tracks the workspace source code path // of the last active deployment. @@ -32,6 +34,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 +65,8 @@ type App struct { // The URL of the app once it is deployed. Url string `json:"url,omitempty"` + UsagePolicyId string `json:"usage_policy_id,omitempty"` + UserApiScopes []string `json:"user_api_scopes,omitempty"` ForceSendFields []string `json:"-" url:"-"` @@ -119,6 +125,7 @@ func (s AppAccessControlResponse) MarshalJSON() ([]byte, error) { } type AppDeployment struct { + Command []string `json:"command,omitempty"` // The creation time of the deployment. Formatted timestamp in ISO 6801. CreateTime string `json:"create_time,omitempty"` // The email of the user creates the deployment. @@ -127,6 +134,10 @@ type AppDeployment struct { DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` // The unique id of the deployment. DeploymentId string `json:"deployment_id,omitempty"` + + EnvVars []EnvVar `json:"env_vars,omitempty"` + // Git repository to use as the source for the app deployment. + GitSource *GitSource `json:"git_source,omitempty"` // The mode of which the deployment will manage the source code. Mode AppDeploymentMode `json:"mode,omitempty"` // The workspace file system path of the source code used to create the app @@ -1427,6 +1438,24 @@ type DeleteCustomTemplateRequest struct { Name string `json:"-" url:"-"` } +type EnvVar struct { + Name string `json:"name,omitempty"` + + Value string `json:"value,omitempty"` + + ValueFrom string `json:"value_from,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EnvVar) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EnvVar) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type GetAppDeploymentRequest struct { // The name of the app. AppName string `json:"-" url:"-"` @@ -1464,6 +1493,40 @@ type GetCustomTemplateRequest struct { Name string `json:"-" url:"-"` } +type GitSource struct { + // Git branch to checkout. + Branch string `json:"branch,omitempty"` + // Git commit SHA to checkout. + Commit string `json:"commit,omitempty"` + // Git provider. Case insensitive. Supported values: gitHub, + // gitHubEnterprise, bitbucketCloud, bitbucketServer, azureDevOpsServices, + // gitLab, gitLabEnterpriseEdition, awsCodeCommit. + Provider string `json:"provider"` + // The resolved commit SHA that was actually used for the deployment. This + // is populated by the system after resolving the reference (branch, tag, or + // commit). If commit is specified directly, this will match commit. If a + // branch or tag is specified, this contains the commit SHA that the branch + // or tag pointed to at deployment time. + ResolvedCommit string `json:"resolved_commit,omitempty"` + // Relative path to the app source code within the Git repository. If not + // specified, the root of the repository is used. + SourceCodePath string `json:"source_code_path,omitempty"` + // Git tag to checkout. + Tag string `json:"tag,omitempty"` + // URL of the Git repository. + Url string `json:"url"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *GitSource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s GitSource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ListAppDeploymentsRequest struct { // The name of the app. AppName string `json:"-" url:"-"` diff --git a/service/billing/api.go b/service/billing/api.go index 55af38059..418513ea2 100755 --- a/service/billing/api.go +++ b/service/billing/api.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// These APIs allow you to manage Billable Usage, Budget Policy, Budgets, Log Delivery, Usage Dashboards, etc. +// These APIs allow you to manage Billable Usage, Budget Policy, Budgets, Log Delivery, Usage Dashboards, Usage Policy, etc. package billing import ( @@ -412,3 +412,63 @@ func NewUsageDashboards(client *client.DatabricksClient) *UsageDashboardsAPI { type UsageDashboardsAPI struct { usageDashboardsImpl } + +type UsagePolicyInterface interface { + + // Creates a new usage policy. + Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) + + // Deletes a usage policy + Delete(ctx context.Context, request DeleteUsagePolicyRequest) error + + // Deletes a usage policy + DeleteByPolicyId(ctx context.Context, policyId string) error + + // Retrieves a usage policy by it's ID. + Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) + + // Retrieves a usage policy by it's ID. + GetByPolicyId(ctx context.Context, policyId string) (*UsagePolicy, error) + + // Lists all usage policies. Policies are returned in the alphabetically + // ascending order of their names. + // + // This method is generated by Databricks SDK Code Generator. + List(ctx context.Context, request ListUsagePoliciesRequest) listing.Iterator[UsagePolicy] + + // Lists all usage policies. Policies are returned in the alphabetically + // ascending order of their names. + // + // This method is generated by Databricks SDK Code Generator. + ListAll(ctx context.Context, request ListUsagePoliciesRequest) ([]UsagePolicy, error) + + // Updates a usage policy + Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) +} + +func NewUsagePolicy(client *client.DatabricksClient) *UsagePolicyAPI { + return &UsagePolicyAPI{ + usagePolicyImpl: usagePolicyImpl{ + client: client, + }, + } +} + +// A service serves REST API about Usage policies +type UsagePolicyAPI struct { + usagePolicyImpl +} + +// Deletes a usage policy +func (a *UsagePolicyAPI) DeleteByPolicyId(ctx context.Context, policyId string) error { + return a.usagePolicyImpl.Delete(ctx, DeleteUsagePolicyRequest{ + PolicyId: policyId, + }) +} + +// Retrieves a usage policy by it's ID. +func (a *UsagePolicyAPI) GetByPolicyId(ctx context.Context, policyId string) (*UsagePolicy, error) { + return a.usagePolicyImpl.Get(ctx, GetUsagePolicyRequest{ + PolicyId: policyId, + }) +} diff --git a/service/billing/impl.go b/service/billing/impl.go index 006e5126a..412d7c9f8 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -11,6 +11,7 @@ import ( "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "github.com/google/uuid" + "golang.org/x/exp/slices" ) // unexported type that holds implementations of just BillableUsage API methods @@ -114,9 +115,13 @@ func (a *budgetPolicyImpl) Update(ctx context.Context, request UpdateBudgetPolic path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) - if request.LimitConfig != nil { + if request.LimitConfig != nil || slices.Contains(request.ForceSendFields, "LimitConfig") { queryParams["limit_config"] = request.LimitConfig } + + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask + } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" @@ -315,3 +320,99 @@ func (a *usageDashboardsImpl) Get(ctx context.Context, request GetBillingUsageDa err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getBillingUsageDashboardResponse) return &getBillingUsageDashboardResponse, err } + +// unexported type that holds implementations of just UsagePolicy API methods +type usagePolicyImpl struct { + client *client.DatabricksClient +} + +func (a *usagePolicyImpl) Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &usagePolicy) + return &usagePolicy, err +} + +func (a *usagePolicyImpl) Delete(ctx context.Context, request DeleteUsagePolicyRequest) error { + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *usagePolicyImpl) Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &usagePolicy) + return &usagePolicy, err +} + +// Lists all usage policies. Policies are returned in the alphabetically +// ascending order of their names. +func (a *usagePolicyImpl) List(ctx context.Context, request ListUsagePoliciesRequest) listing.Iterator[UsagePolicy] { + + getNextPage := func(ctx context.Context, req ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalList(ctx, req) + } + getItems := func(resp *ListUsagePoliciesResponse) []UsagePolicy { + return resp.Policies + } + getNextReq := func(resp *ListUsagePoliciesResponse) *ListUsagePoliciesRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// Lists all usage policies. Policies are returned in the alphabetically +// ascending order of their names. +func (a *usagePolicyImpl) ListAll(ctx context.Context, request ListUsagePoliciesRequest) ([]UsagePolicy, error) { + iterator := a.List(ctx, request) + return listing.ToSlice[UsagePolicy](ctx, iterator) +} + +func (a *usagePolicyImpl) internalList(ctx context.Context, request ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) { + var listUsagePoliciesResponse ListUsagePoliciesResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies", a.client.ConfiguredAccountID()) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsagePoliciesResponse) + return &listUsagePoliciesResponse, err +} + +func (a *usagePolicyImpl) Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) { + var usagePolicy UsagePolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/usage-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) + queryParams := make(map[string]any) + + if request.LimitConfig != nil { + queryParams["limit_config"] = request.LimitConfig + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &usagePolicy) + return &usagePolicy, err +} diff --git a/service/billing/interface.go b/service/billing/interface.go index e251dd3df..4cbd4cb9f 100755 --- a/service/billing/interface.go +++ b/service/billing/interface.go @@ -208,3 +208,25 @@ type UsageDashboardsService interface { // type. Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error) } + +// A service serves REST API about Usage policies +// +// Deprecated: Do not use this interface, it will be removed in a future version of the SDK. +type UsagePolicyService interface { + + // Creates a new usage policy. + Create(ctx context.Context, request CreateUsagePolicyRequest) (*UsagePolicy, error) + + // Deletes a usage policy + Delete(ctx context.Context, request DeleteUsagePolicyRequest) error + + // Retrieves a usage policy by it's ID. + Get(ctx context.Context, request GetUsagePolicyRequest) (*UsagePolicy, error) + + // Lists all usage policies. Policies are returned in the alphabetically + // ascending order of their names. + List(ctx context.Context, request ListUsagePoliciesRequest) (*ListUsagePoliciesResponse, error) + + // Updates a usage policy + Update(ctx context.Context, request UpdateUsagePolicyRequest) (*UsagePolicy, error) +} diff --git a/service/billing/model.go b/service/billing/model.go index 720b1b671..e518222b6 100644 --- a/service/billing/model.go +++ b/service/billing/model.go @@ -539,6 +539,25 @@ func (s CreateLogDeliveryConfigurationParams) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// A request to create a UsagePolicy. +type CreateUsagePolicyRequest struct { + // The policy to create. `policy_id` needs to be empty as it will be + // generated + Policy *UsagePolicy `json:"policy,omitempty"` + // A unique identifier for this request. Restricted to 36 ASCII characters. + RequestId string `json:"request_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateUsagePolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateUsagePolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type DeleteBudgetConfigurationRequest struct { // The Databricks budget configuration ID. BudgetId string `json:"-" url:"-"` @@ -549,6 +568,11 @@ type DeleteBudgetPolicyRequest struct { PolicyId string `json:"-" url:"-"` } +type DeleteUsagePolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + // * The status string for log delivery. Possible values are: `CREATED`: There // were no log delivery attempts since the config was created. `SUCCEEDED`: The // latest attempt of log delivery has succeeded completely. `USER_FAILURE`: The @@ -718,6 +742,11 @@ type GetLogDeliveryRequest struct { LogDeliveryConfigurationId string `json:"-" url:"-"` } +type GetUsagePolicyRequest struct { + // The Id of the policy. + PolicyId string `json:"-" url:"-"` +} + // The limit configuration of the policy. Limit configuration provide a budget // policy level cost control by enforcing the limit. type LimitConfig struct { @@ -831,6 +860,47 @@ func (s ListLogDeliveryRequest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type ListUsagePoliciesRequest struct { + // A filter to apply to the list of policies. + FilterBy *Filter `json:"-" url:"filter_by,omitempty"` + // The maximum number of usage policies to return. + PageSize int `json:"-" url:"page_size,omitempty"` + // A page token, received from a previous `ListUsagePolicies` call. + PageToken string `json:"-" url:"page_token,omitempty"` + // The sort specification. + SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsagePoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsagePoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// A list of usage policies. +type ListUsagePoliciesResponse struct { + // A token that can be sent as `page_token` to retrieve the next page. + NextPageToken string `json:"next_page_token,omitempty"` + + Policies []UsagePolicy `json:"policies,omitempty"` + // A token that can be sent as `page_token` to retrieve the previous page. + PreviousPageToken string `json:"previous_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *ListUsagePoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s ListUsagePoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // * Log Delivery Status // // `ENABLED`: All dependencies have executed and succeeded `DISABLED`: At least @@ -1173,6 +1243,19 @@ type UpdateBudgetPolicyRequest struct { // The Id of the policy. This field is generated by Databricks and globally // unique. PolicyId string `json:"-" url:"-"` + // Field mask specifying which fields to update. When not provided, all + // fields are updated. + UpdateMask string `json:"-" url:"update_mask,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * Update Log Delivery Configuration @@ -1187,6 +1270,18 @@ type UpdateLogDeliveryConfigurationStatusRequest struct { Status LogDeliveryConfigStatus `json:"status"` } +type UpdateUsagePolicyRequest struct { + // DEPRECATED. This is redundant field as LimitConfig is part of the + // UsagePolicy + LimitConfig *LimitConfig `json:"-" url:"limit_config,omitempty"` + // The policy to update. `creator_user_id` cannot be specified in the + // request. + Policy UsagePolicy `json:"policy"` + // The Id of the policy. This field is generated by Databricks and globally + // unique. + PolicyId string `json:"-" url:"-"` +} + type UsageDashboardType string const UsageDashboardTypeUsageDashboardTypeGlobal UsageDashboardType = `USAGE_DASHBOARD_TYPE_GLOBAL` @@ -1224,6 +1319,30 @@ func (f *UsageDashboardType) Type() string { return "UsageDashboardType" } +// Contains the UsagePolicy details (same structure as BudgetPolicy) +type UsagePolicy struct { + // List of workspaces that this usage policy will be exclusively bound to. + BindingWorkspaceIds []int64 `json:"binding_workspace_ids,omitempty"` + // A list of tags defined by the customer. At most 20 entries are allowed + // per policy. + CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` + // The Id of the policy. This field is generated by Databricks and globally + // unique. + PolicyId string `json:"policy_id,omitempty"` + // The name of the policy. + PolicyName string `json:"policy_name,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UsagePolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UsagePolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // * Properties of the new log delivery configuration. type WrappedCreateLogDeliveryConfiguration struct { LogDeliveryConfiguration CreateLogDeliveryConfigurationParams `json:"log_delivery_configuration"` diff --git a/service/catalog/api.go b/service/catalog/api.go index b0fed8f3a..74d4b5580 100755 --- a/service/catalog/api.go +++ b/service/catalog/api.go @@ -2317,12 +2317,11 @@ func NewRfa(client *client.DatabricksClient) *RfaAPI { } } -// Request for Access enables customers to request access to and manage access -// request destinations for Unity Catalog securables. +// Request for Access enables users to request access for Unity Catalog +// securables. // -// These APIs provide a standardized way to update, get, and request to access -// request destinations. Fine-grained authorization ensures that only users with -// appropriate permissions can manage access request destinations. +// These APIs provide a standardized way for securable owners (or users with +// MANAGE privileges) to manage access request destinations. type RfaAPI struct { rfaImpl } diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 6584eeee1..9a46b7263 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -340,6 +340,8 @@ func (a *catalogsImpl) Get(ctx context.Context, request GetCatalogRequest) (*Cat // indication that the end of results has been reached. func (a *catalogsImpl) List(ctx context.Context, request ListCatalogsRequest) listing.Iterator[CatalogInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListCatalogsRequest) (*ListCatalogsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -447,6 +449,8 @@ func (a *connectionsImpl) Get(ctx context.Context, request GetConnectionRequest) // indication that the end of results has been reached. func (a *connectionsImpl) List(ctx context.Context, request ListConnectionsRequest) listing.Iterator[ConnectionInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListConnectionsRequest) (*ListConnectionsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -867,6 +871,8 @@ func (a *externalLocationsImpl) Get(ctx context.Context, request GetExternalLoca // indication that the end of results has been reached. func (a *externalLocationsImpl) List(ctx context.Context, request ListExternalLocationsRequest) listing.Iterator[ExternalLocationInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListExternalLocationsRequest) (*ListExternalLocationsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -1078,6 +1084,8 @@ func (a *functionsImpl) Get(ctx context.Context, request GetFunctionRequest) (*F // indication that the end of results has been reached. func (a *functionsImpl) List(ctx context.Context, request ListFunctionsRequest) listing.Iterator[FunctionInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListFunctionsRequest) (*ListFunctionsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -1245,6 +1253,8 @@ func (a *metastoresImpl) Get(ctx context.Context, request GetMetastoreRequest) ( // indication that the end of results has been reached. func (a *metastoresImpl) List(ctx context.Context, request ListMetastoresRequest) listing.Iterator[MetastoreInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListMetastoresRequest) (*ListMetastoresResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -1986,6 +1996,8 @@ func (a *schemasImpl) Get(ctx context.Context, request GetSchemaRequest) (*Schem // indication that the end of results has been reached. func (a *schemasImpl) List(ctx context.Context, request ListSchemasRequest) listing.Iterator[SchemaInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListSchemasRequest) (*ListSchemasResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -2097,6 +2109,8 @@ func (a *storageCredentialsImpl) Get(ctx context.Context, request GetStorageCred // indication that the end of results has been reached. func (a *storageCredentialsImpl) List(ctx context.Context, request ListStorageCredentialsRequest) listing.Iterator[StorageCredentialInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListStorageCredentialsRequest) (*ListStorageCredentialsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -2205,6 +2219,8 @@ func (a *systemSchemasImpl) Enable(ctx context.Context, request EnableRequest) e // indication that the end of results has been reached. func (a *systemSchemasImpl) List(ctx context.Context, request ListSystemSchemasRequest) listing.Iterator[SystemSchemaInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListSystemSchemasRequest) (*ListSystemSchemasResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -2338,6 +2354,8 @@ func (a *tablesImpl) Get(ctx context.Context, request GetTableRequest) (*TableIn // indication that the end of results has been reached. func (a *tablesImpl) List(ctx context.Context, request ListTablesRequest) listing.Iterator[TableInfo] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req ListTablesRequest) (*ListTablesResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalList(ctx, req) @@ -2645,6 +2663,8 @@ func (a *workspaceBindingsImpl) Get(ctx context.Context, request GetWorkspaceBin // indication that the end of results has been reached. func (a *workspaceBindingsImpl) GetBindings(ctx context.Context, request GetBindingsRequest) listing.Iterator[WorkspaceBinding] { + request.ForceSendFields = append(request.ForceSendFields, "MaxResults") + getNextPage := func(ctx context.Context, req GetBindingsRequest) (*GetWorkspaceBindingsResponse, error) { ctx = useragent.InContext(ctx, "sdk-feature", "pagination") return a.internalGetBindings(ctx, req) diff --git a/service/catalog/interface.go b/service/catalog/interface.go index 32a2172ce..1314358c6 100755 --- a/service/catalog/interface.go +++ b/service/catalog/interface.go @@ -1028,12 +1028,11 @@ type ResourceQuotasService interface { ListQuotas(ctx context.Context, request ListQuotasRequest) (*ListQuotasResponse, error) } -// Request for Access enables customers to request access to and manage access -// request destinations for Unity Catalog securables. +// Request for Access enables users to request access for Unity Catalog +// securables. // -// These APIs provide a standardized way to update, get, and request to access -// request destinations. Fine-grained authorization ensures that only users with -// appropriate permissions can manage access request destinations. +// These APIs provide a standardized way for securable owners (or users with +// MANAGE privileges) to manage access request destinations. // // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type RfaService interface { diff --git a/service/catalog/model.go b/service/catalog/model.go index bbe43c2da..b92791030 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -14,7 +14,7 @@ type AccessRequestDestinations struct { // permission to see all destinations. AreAnyDestinationsHidden bool `json:"are_any_destinations_hidden,omitempty"` // The access request destinations for the securable. - Destinations []NotificationDestination `json:"destinations"` + Destinations []NotificationDestination `json:"destinations,omitempty"` // The securable for which the access request destinations are being // retrieved. Securable Securable `json:"securable"` @@ -516,10 +516,14 @@ type CatalogInfo struct { Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` // Time at which this catalog was created, in epoch milliseconds. CreatedAt int64 `json:"created_at,omitempty"` // Username of catalog creator. CreatedBy string `json:"created_by,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` // Whether predictive optimization should be enabled for this object and @@ -892,6 +896,9 @@ type ConnectionInfo struct { CreatedBy string `json:"created_by,omitempty"` // The type of credential. CredentialType CredentialType `json:"credential_type,omitempty"` + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Full name of connection. FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. @@ -928,7 +935,7 @@ func (s ConnectionInfo) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Next Id: 47 +// Next Id: 48 type ConnectionType string const ConnectionTypeBigquery ConnectionType = `BIGQUERY` @@ -1047,6 +1054,49 @@ func (s ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Status of conversion of FOREIGN entity into UC Native entity. +type ConversionInfo struct { + // The conversion state of the resource. + State ConversionInfoState `json:"state,omitempty"` +} + +type ConversionInfoState string + +const ConversionInfoStateCompleted ConversionInfoState = `COMPLETED` + +const ConversionInfoStateInProgress ConversionInfoState = `IN_PROGRESS` + +// String representation for [fmt.Print] +func (f *ConversionInfoState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ConversionInfoState) Set(v string) error { + switch v { + case `COMPLETED`, `IN_PROGRESS`: + *f = ConversionInfoState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "COMPLETED", "IN_PROGRESS"`, v) + } +} + +// Values returns all possible values for ConversionInfoState. +// +// There is no guarantee on the order of the values in the slice. +func (f *ConversionInfoState) Values() []ConversionInfoState { + return []ConversionInfoState{ + ConversionInfoStateCompleted, + ConversionInfoStateInProgress, + } +} + +// Type always returns ConversionInfoState to satisfy [pflag.Value] interface +func (f *ConversionInfoState) Type() string { + return "ConversionInfoState" +} + type CreateAccessRequest struct { // Optional. The principal this request is for. Empty `behalf_of` defaults // to the requester's identity. @@ -1138,6 +1188,10 @@ type CreateCatalog struct { Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. ConnectionName string `json:"connection_name,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Name of catalog. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -1170,6 +1224,9 @@ type CreateConnection struct { Comment string `json:"comment,omitempty"` // The type of connection. ConnectionType ConnectionType `json:"connection_type"` + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"name"` // A map of key-value properties attached to the securable. @@ -2518,6 +2575,48 @@ type DisableRequest struct { SchemaName string `json:"-" url:"-"` } +// Metadata related to Disaster Recovery. +type DrReplicationInfo struct { + Status DrReplicationStatus `json:"status,omitempty"` +} + +type DrReplicationStatus string + +const DrReplicationStatusDrReplicationStatusPrimary DrReplicationStatus = `DR_REPLICATION_STATUS_PRIMARY` + +const DrReplicationStatusDrReplicationStatusSecondary DrReplicationStatus = `DR_REPLICATION_STATUS_SECONDARY` + +// String representation for [fmt.Print] +func (f *DrReplicationStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *DrReplicationStatus) Set(v string) error { + switch v { + case `DR_REPLICATION_STATUS_PRIMARY`, `DR_REPLICATION_STATUS_SECONDARY`: + *f = DrReplicationStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "DR_REPLICATION_STATUS_PRIMARY", "DR_REPLICATION_STATUS_SECONDARY"`, v) + } +} + +// Values returns all possible values for DrReplicationStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *DrReplicationStatus) Values() []DrReplicationStatus { + return []DrReplicationStatus{ + DrReplicationStatusDrReplicationStatusPrimary, + DrReplicationStatusDrReplicationStatusSecondary, + } +} + +// Type always returns DrReplicationStatus to satisfy [pflag.Value] interface +func (f *DrReplicationStatus) Type() string { + return "DrReplicationStatus" +} + type EffectivePermissionsList struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next @@ -2726,6 +2825,22 @@ func (s EntityTagAssignment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type EnvironmentSettings struct { + EnvironmentVersion string `json:"environment_version,omitempty"` + + JavaDependencies []string `json:"java_dependencies,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EnvironmentSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EnvironmentSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ExistsRequest struct { // Full name of the table. FullName string `json:"-" url:"-"` @@ -3536,6 +3651,8 @@ type GenerateTemporaryPathCredentialResponse struct { GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` + + UcEncryptedToken *UcEncryptedToken `json:"uc_encrypted_token,omitempty"` // The URL of the storage path accessible by the temporary credential. Url string `json:"url,omitempty"` @@ -3607,6 +3724,8 @@ type GenerateTemporaryTableCredentialResponse struct { GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` + + UcEncryptedToken *UcEncryptedToken `json:"uc_encrypted_token,omitempty"` // The URL of the storage path accessible by the temporary credential. Url string `json:"url,omitempty"` @@ -3819,6 +3938,9 @@ func (s GetFunctionRequest) MarshalJSON() ([]byte, error) { type GetGrantRequest struct { // Full name of securable. FullName string `json:"-" url:"-"` + // Optional. If true, also return privilege assignments whose principals + // have been deleted. + IncludeDeletedPrincipals bool `json:"-" url:"include_deleted_principals,omitempty"` // Specifies the maximum number of privileges to return (page length). Every // PrivilegeAssignment present in a single page response is guaranteed to // contain all the privileges granted on the requested Securable for the @@ -6163,6 +6285,16 @@ type PermissionsChange struct { // The principal whose privileges we are changing. Only one of principal or // principal_id should be specified, never both at the same time. Principal string `json:"principal,omitempty"` + // An opaque internal ID that identifies the principal whose privileges + // should be removed. + // + // This field is intended for removing privileges associated with a deleted + // user. When set, only the entries specified in the remove field are + // processed; any entries in the add field will be rejected. + // + // Only one of principal or principal_id should be specified, never both at + // the same time. + PrincipalId int64 `json:"principal_id,omitempty"` // The set of privileges to remove. Remove []Privilege `json:"remove,omitempty"` @@ -6567,6 +6699,9 @@ type PrivilegeAssignment struct { // The principal (user email address or group name). For deleted principals, // `principal` is empty while `principal_id` is populated. Principal string `json:"principal,omitempty"` + // Unique identifier of the principal. For active principals, both + // `principal` and `principal_id` are present. + PrincipalId int64 `json:"principal_id,omitempty"` // The privileges assigned to the principal. Privileges []Privilege `json:"privileges,omitempty"` @@ -6912,7 +7047,7 @@ func (s Securable) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } -// Latest kind: CONNECTION_AWS_SECRETS_MANAGER = 270; Next id:271 +// Latest kind: CONNECTION_SLACK_OAUTH_U2M_MAPPING = 272; Next id:273 type SecurableKind string const SecurableKindTableDbStorage SecurableKind = `TABLE_DB_STORAGE` @@ -7846,6 +7981,24 @@ func (s TriggeredUpdateStatus) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Encrypted token used when we cannot downscope the cloud provider token +// appropriately See: +// https://docs.google.com/document/d/1hEKDnSckuU5PIS798CtfqBElrMR6OJuR2wgz_BjhMSY +type UcEncryptedToken struct { + // Stores encrypted ScopedCloudToken as a base64-encoded string + EncryptedPayload string `json:"encrypted_payload,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UcEncryptedToken) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UcEncryptedToken) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UnassignRequest struct { // Query for the ID of the metastore to delete. MetastoreId string `json:"-" url:"metastore_id"` @@ -7935,6 +8088,10 @@ func (s UpdateAccountsStorageCredential) MarshalJSON() ([]byte, error) { type UpdateCatalog struct { // User-provided free-form text description. Comment string `json:"comment,omitempty"` + // Status of conversion of FOREIGN catalog to UC Native catalog. + ConversionInfo *ConversionInfo `json:"conversion_info,omitempty"` + // Disaster Recovery replication state snapshot. + DrReplicationInfo *DrReplicationInfo `json:"dr_replication_info,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` @@ -7969,6 +8126,9 @@ type UpdateCatalogWorkspaceBindingsResponse struct { } type UpdateConnection struct { + // [Create,Update:OPT] Connection environment settings as + // EnvironmentSettings object. + EnvironmentSettings *EnvironmentSettings `json:"environment_settings,omitempty"` // Name of the connection. Name string `json:"-" url:"-"` // New name for the connection. diff --git a/service/cleanrooms/model.go b/service/cleanrooms/model.go index 042dc7f71..b228822ac 100755 --- a/service/cleanrooms/model.go +++ b/service/cleanrooms/model.go @@ -21,6 +21,10 @@ type CleanRoom struct { Comment string `json:"comment,omitempty"` // When the clean room was created, in epoch milliseconds. CreatedAt int64 `json:"created_at,omitempty"` + // Whether allow task to write to shared output schema. When enabled, clean + // room task runs triggered by the current collaborator can write to the + // run-scoped shared output schema which is accessible by all collaborators. + EnableSharedOutput bool `json:"enable_shared_output,omitempty"` // The alias of the collaborator tied to the local clean room. LocalCollaboratorAlias string `json:"local_collaborator_alias,omitempty"` // The name of the clean room. It should follow [UC securable naming @@ -531,6 +535,13 @@ type CleanRoomNotebookTaskRun struct { OutputSchemaName string `json:"output_schema_name,omitempty"` // Duration of the task run, in milliseconds. RunDuration int64 `json:"run_duration,omitempty"` + // Expiration time of the shared output schema of the task run (if any), in + // epoch milliseconds. + SharedOutputSchemaExpirationTime int64 `json:"shared_output_schema_expiration_time,omitempty"` + // Name of the shared output schema associated with the clean rooms notebook + // task run. This schema is accessible by all collaborators when + // enable_shared_output is true. + SharedOutputSchemaName string `json:"shared_output_schema_name,omitempty"` // When the task run started, in epoch milliseconds. StartTime int64 `json:"start_time,omitempty"` diff --git a/service/compute/api.go b/service/compute/api.go index ec56e450a..57a2714d4 100755 --- a/service/compute/api.go +++ b/service/compute/api.go @@ -1999,14 +1999,64 @@ type LibrariesInterface interface { // particular order, are returned last. ClusterStatusByClusterId(ctx context.Context, clusterId string) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the environment + // version and a list of dependencies to be used in serverless notebooks and + // jobs. This process will asynchronously generate a cache to optimize + // dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Delete the default base environment given an ID. The default base environment + // may be used by downstream workloads. Please ensure that the deletion is + // intentional. + DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; it // happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] + + // List default base environments defined in the workspaces for the requested + // user. + // + // This method is generated by Databricks SDK Code Generator. + ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + + // Refresh the cached default base environments for the given IDs. This process + // will asynchronously regenerate the caches. The existing caches remains + // available until it expires. + RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error + // Set libraries to uninstall from a cluster. The libraries won't be uninstalled // until the cluster is restarted. A request to uninstall a library that is not // currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the specified + // DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } func NewLibraries(client *client.DatabricksClient) *LibrariesAPI { @@ -2050,6 +2100,24 @@ func (a *LibrariesAPI) ClusterStatusByClusterId(ctx context.Context, clusterId s }) } +// Delete the default base environment given an ID. The default base environment +// may be used by downstream workloads. Please ensure that the deletion is +// intentional. +func (a *LibrariesAPI) DeleteDefaultBaseEnvironmentById(ctx context.Context, id string) error { + return a.librariesImpl.DeleteDefaultBaseEnvironment(ctx, DeleteDefaultBaseEnvironmentRequest{ + Id: id, + }) +} + +// Refresh the cached default base environments for the given IDs. This process +// will asynchronously regenerate the caches. The existing caches remains +// available until it expires. +func (a *LibrariesAPI) RefreshDefaultBaseEnvironmentsByIds(ctx context.Context, ids []string) error { + return a.librariesImpl.RefreshDefaultBaseEnvironments(ctx, RefreshDefaultBaseEnvironmentsRequest{ + Ids: ids, + }) +} + type PolicyComplianceForClustersInterface interface { // Updates a cluster to be compliant with the current version of its policy. A diff --git a/service/compute/impl.go b/service/compute/impl.go index d41f7f64c..cce75a8d4 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -10,6 +10,7 @@ import ( "github.com/databricks/databricks-sdk-go/client" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" + "github.com/google/uuid" ) // unexported type that holds implementations of just ClusterPolicies API methods @@ -869,6 +870,39 @@ func (a *librariesImpl) internalClusterStatus(ctx context.Context, request Clust return &clusterLibraryStatuses, err } +func (a *librariesImpl) CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + if request.RequestId == "" { + request.RequestId = uuid.New().String() + } + path := "/api/2.0/default-base-environments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error { + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *librariesImpl) GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:getDefaultBaseEnvironment" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) error { path := "/api/2.0/libraries/install" queryParams := make(map[string]any) @@ -879,6 +913,59 @@ func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) e return err } +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) listing.Iterator[DefaultBaseEnvironment] { + + getNextPage := func(ctx context.Context, req ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + ctx = useragent.InContext(ctx, "sdk-feature", "pagination") + return a.internalListDefaultBaseEnvironments(ctx, req) + } + getItems := func(resp *ListDefaultBaseEnvironmentsResponse) []DefaultBaseEnvironment { + return resp.DefaultBaseEnvironments + } + getNextReq := func(resp *ListDefaultBaseEnvironmentsResponse) *ListDefaultBaseEnvironmentsRequest { + if resp.NextPageToken == "" { + return nil + } + request.PageToken = resp.NextPageToken + return &request + } + iterator := listing.NewIterator( + &request, + getNextPage, + getItems, + getNextReq) + return iterator +} + +// List default base environments defined in the workspaces for the requested +// user. +func (a *librariesImpl) ListDefaultBaseEnvironmentsAll(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) ([]DefaultBaseEnvironment, error) { + iterator := a.ListDefaultBaseEnvironments(ctx, request) + return listing.ToSlice[DefaultBaseEnvironment](ctx, iterator) +} + +func (a *librariesImpl) internalListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) { + var listDefaultBaseEnvironmentsResponse ListDefaultBaseEnvironmentsResponse + path := "/api/2.0/default-base-environments" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDefaultBaseEnvironmentsResponse) + return &listDefaultBaseEnvironmentsResponse, err +} + +func (a *librariesImpl) RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error { + path := "/api/2.0/default-base-environments/refresh" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) + return err +} + func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibraries) error { path := "/api/2.0/libraries/uninstall" queryParams := make(map[string]any) @@ -889,6 +976,28 @@ func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibrarie return err } +func (a *librariesImpl) UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := fmt.Sprintf("/api/2.0/default-base-environments/%v", request.Id) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + +func (a *librariesImpl) UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) { + var defaultBaseEnvironment DefaultBaseEnvironment + path := "/api/2.0/default-base-environments:setDefault" + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &defaultBaseEnvironment) + return &defaultBaseEnvironment, err +} + // unexported type that holds implementations of just PolicyComplianceForClusters API methods type policyComplianceForClustersImpl struct { client *client.DatabricksClient diff --git a/service/compute/interface.go b/service/compute/interface.go index 71a8405b4..aec7ea425 100755 --- a/service/compute/interface.go +++ b/service/compute/interface.go @@ -442,14 +442,46 @@ type LibrariesService interface { // removal, in no particular order, are returned last. ClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) + // Create a default base environment within workspaces to define the + // environment version and a list of dependencies to be used in serverless + // notebooks and jobs. This process will asynchronously generate a cache to + // optimize dependency resolution. + CreateDefaultBaseEnvironment(ctx context.Context, request CreateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Delete the default base environment given an ID. The default base + // environment may be used by downstream workloads. Please ensure that the + // deletion is intentional. + DeleteDefaultBaseEnvironment(ctx context.Context, request DeleteDefaultBaseEnvironmentRequest) error + + // Return the default base environment details for a given ID. + GetDefaultBaseEnvironment(ctx context.Context, request GetDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + // Add libraries to install on a cluster. The installation is asynchronous; // it happens in the background after the completion of this request. Install(ctx context.Context, request InstallLibraries) error + // List default base environments defined in the workspaces for the + // requested user. + ListDefaultBaseEnvironments(ctx context.Context, request ListDefaultBaseEnvironmentsRequest) (*ListDefaultBaseEnvironmentsResponse, error) + + // Refresh the cached default base environments for the given IDs. This + // process will asynchronously regenerate the caches. The existing caches + // remains available until it expires. + RefreshDefaultBaseEnvironments(ctx context.Context, request RefreshDefaultBaseEnvironmentsRequest) error + // Set libraries to uninstall from a cluster. The libraries won't be // uninstalled until the cluster is restarted. A request to uninstall a // library that is not currently installed is ignored. Uninstall(ctx context.Context, request UninstallLibraries) error + + // Update the default base environment for the given ID. This process will + // asynchronously regenerate the cache. The existing cache remains available + // until it expires. + UpdateDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) + + // Set the default base environment for the workspace. This marks the + // specified DBE as the workspace default. + UpdateDefaultDefaultBaseEnvironment(ctx context.Context, request UpdateDefaultDefaultBaseEnvironmentRequest) (*DefaultBaseEnvironment, error) } // The policy compliance APIs allow you to view and manage the policy compliance diff --git a/service/compute/model.go b/service/compute/model.go index f93551947..dc343118e 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -143,7 +143,7 @@ type AwsAttributes struct { // availability zone must be in the same region as the Databricks // deployment. For example, "us-west-2a" is not a valid zone id if the // Databricks deployment resides in the "us-east-1" region. This is an - // optional field at cluster creation, and if not specified, a default zone + // optional field at cluster creation, and if not specified, the zone "auto" // will be used. If the zone specified is "auto", will try to place cluster // in a zone with high availability, and will retry placement in a different // AZ if there is not enough capacity. @@ -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 @@ -2770,6 +2958,8 @@ const EventDetailsCauseAutorecovery EventDetailsCause = `AUTORECOVERY` const EventDetailsCauseAutoscale EventDetailsCause = `AUTOSCALE` +const EventDetailsCauseAutoscaleV2 EventDetailsCause = `AUTOSCALE_V2` + const EventDetailsCauseReplaceBadNodes EventDetailsCause = `REPLACE_BAD_NODES` const EventDetailsCauseUserRequest EventDetailsCause = `USER_REQUEST` @@ -2782,11 +2972,11 @@ func (f *EventDetailsCause) String() string { // Set raw string value and validate it against allowed values func (f *EventDetailsCause) Set(v string) error { switch v { - case `AUTORECOVERY`, `AUTOSCALE`, `REPLACE_BAD_NODES`, `USER_REQUEST`: + case `AUTORECOVERY`, `AUTOSCALE`, `AUTOSCALE_V2`, `REPLACE_BAD_NODES`, `USER_REQUEST`: *f = EventDetailsCause(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "AUTORECOVERY", "AUTOSCALE", "REPLACE_BAD_NODES", "USER_REQUEST"`, v) + return fmt.Errorf(`value "%s" is not one of "AUTORECOVERY", "AUTOSCALE", "AUTOSCALE_V2", "REPLACE_BAD_NODES", "USER_REQUEST"`, v) } } @@ -2797,6 +2987,7 @@ func (f *EventDetailsCause) Values() []EventDetailsCause { return []EventDetailsCause{ EventDetailsCauseAutorecovery, EventDetailsCauseAutoscale, + EventDetailsCauseAutoscaleV2, EventDetailsCauseReplaceBadNodes, EventDetailsCauseUserRequest, } @@ -3105,6 +3296,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"` @@ -3253,6 +3460,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 @@ -3281,6 +3492,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 @@ -3720,6 +3936,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 @@ -3748,6 +3968,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 @@ -4620,6 +4845,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"` } @@ -4795,6 +5052,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"` @@ -4911,6 +5198,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"` @@ -5058,6 +5351,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"` @@ -6259,6 +6556,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..a111a0465 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:"-"` @@ -1028,6 +1204,8 @@ const MessageErrorTypeUnexpectedReplyProcessException MessageErrorType = `UNEXPE const MessageErrorTypeUnknownAiModel MessageErrorType = `UNKNOWN_AI_MODEL` +const MessageErrorTypeUnsupportedConversationTypeException MessageErrorType = `UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION` + const MessageErrorTypeWarehouseAccessMissingException MessageErrorType = `WAREHOUSE_ACCESS_MISSING_EXCEPTION` const MessageErrorTypeWarehouseNotFoundException MessageErrorType = `WAREHOUSE_NOT_FOUND_EXCEPTION` @@ -1040,11 +1218,11 @@ func (f *MessageErrorType) String() string { // Set raw string value and validate it against allowed values func (f *MessageErrorType) Set(v string) error { switch v { - case `BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION`, `CHAT_COMPLETION_CLIENT_EXCEPTION`, `CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION`, `CHAT_COMPLETION_NETWORK_EXCEPTION`, `CONTENT_FILTER_EXCEPTION`, `CONTEXT_EXCEEDED_EXCEPTION`, `COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION`, `COULD_NOT_GET_UC_SCHEMA_EXCEPTION`, `DEPLOYMENT_NOT_FOUND_EXCEPTION`, `DESCRIBE_QUERY_INVALID_SQL_ERROR`, `DESCRIBE_QUERY_TIMEOUT`, `DESCRIBE_QUERY_UNEXPECTED_FAILURE`, `EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION`, `FUNCTIONS_NOT_AVAILABLE_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION`, `FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION`, `GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION`, `GENERIC_CHAT_COMPLETION_EXCEPTION`, `GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION`, `GENERIC_SQL_EXEC_API_CALL_EXCEPTION`, `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION`, `INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION`, `INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION`, `INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION`, `INVALID_CHAT_COMPLETION_JSON_EXCEPTION`, `INVALID_COMPLETION_REQUEST_EXCEPTION`, `INVALID_FUNCTION_CALL_EXCEPTION`, `INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION`, `INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION`, `INVALID_SQL_UNKNOWN_TABLE_EXCEPTION`, `INVALID_TABLE_IDENTIFIER_EXCEPTION`, `LOCAL_CONTEXT_EXCEEDED_EXCEPTION`, `MESSAGE_ATTACHMENT_TOO_LONG_ERROR`, `MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION`, `MISSING_SQL_QUERY_EXCEPTION`, `NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE`, `NO_QUERY_TO_VISUALIZE_EXCEPTION`, `NO_TABLES_TO_QUERY_EXCEPTION`, `RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION`, `RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION`, `REPLY_PROCESS_TIMEOUT_EXCEPTION`, `RETRYABLE_PROCESSING_EXCEPTION`, `SQL_EXECUTION_EXCEPTION`, `STOP_PROCESS_DUE_TO_AUTO_REGENERATE`, `TABLES_MISSING_EXCEPTION`, `TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION`, `TOO_MANY_TABLES_EXCEPTION`, `UNEXPECTED_REPLY_PROCESS_EXCEPTION`, `UNKNOWN_AI_MODEL`, `WAREHOUSE_ACCESS_MISSING_EXCEPTION`, `WAREHOUSE_NOT_FOUND_EXCEPTION`: + case `BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION`, `CHAT_COMPLETION_CLIENT_EXCEPTION`, `CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION`, `CHAT_COMPLETION_NETWORK_EXCEPTION`, `CONTENT_FILTER_EXCEPTION`, `CONTEXT_EXCEEDED_EXCEPTION`, `COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION`, `COULD_NOT_GET_UC_SCHEMA_EXCEPTION`, `DEPLOYMENT_NOT_FOUND_EXCEPTION`, `DESCRIBE_QUERY_INVALID_SQL_ERROR`, `DESCRIBE_QUERY_TIMEOUT`, `DESCRIBE_QUERY_UNEXPECTED_FAILURE`, `EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION`, `FUNCTIONS_NOT_AVAILABLE_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION`, `FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION`, `GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION`, `GENERIC_CHAT_COMPLETION_EXCEPTION`, `GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION`, `GENERIC_SQL_EXEC_API_CALL_EXCEPTION`, `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION`, `INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION`, `INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION`, `INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION`, `INVALID_CHAT_COMPLETION_JSON_EXCEPTION`, `INVALID_COMPLETION_REQUEST_EXCEPTION`, `INVALID_FUNCTION_CALL_EXCEPTION`, `INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION`, `INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION`, `INVALID_SQL_UNKNOWN_TABLE_EXCEPTION`, `INVALID_TABLE_IDENTIFIER_EXCEPTION`, `LOCAL_CONTEXT_EXCEEDED_EXCEPTION`, `MESSAGE_ATTACHMENT_TOO_LONG_ERROR`, `MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION`, `MISSING_SQL_QUERY_EXCEPTION`, `NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE`, `NO_QUERY_TO_VISUALIZE_EXCEPTION`, `NO_TABLES_TO_QUERY_EXCEPTION`, `RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION`, `RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION`, `REPLY_PROCESS_TIMEOUT_EXCEPTION`, `RETRYABLE_PROCESSING_EXCEPTION`, `SQL_EXECUTION_EXCEPTION`, `STOP_PROCESS_DUE_TO_AUTO_REGENERATE`, `TABLES_MISSING_EXCEPTION`, `TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION`, `TOO_MANY_TABLES_EXCEPTION`, `UNEXPECTED_REPLY_PROCESS_EXCEPTION`, `UNKNOWN_AI_MODEL`, `UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION`, `WAREHOUSE_ACCESS_MISSING_EXCEPTION`, `WAREHOUSE_NOT_FOUND_EXCEPTION`: *f = MessageErrorType(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION", "CHAT_COMPLETION_CLIENT_EXCEPTION", "CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION", "CHAT_COMPLETION_NETWORK_EXCEPTION", "CONTENT_FILTER_EXCEPTION", "CONTEXT_EXCEEDED_EXCEPTION", "COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION", "COULD_NOT_GET_UC_SCHEMA_EXCEPTION", "DEPLOYMENT_NOT_FOUND_EXCEPTION", "DESCRIBE_QUERY_INVALID_SQL_ERROR", "DESCRIBE_QUERY_TIMEOUT", "DESCRIBE_QUERY_UNEXPECTED_FAILURE", "EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION", "FUNCTIONS_NOT_AVAILABLE_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION", "FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION", "GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION", "GENERIC_CHAT_COMPLETION_EXCEPTION", "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION", "GENERIC_SQL_EXEC_API_CALL_EXCEPTION", "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION", "INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION", "INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION", "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION", "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION", "INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION", "INVALID_CHAT_COMPLETION_JSON_EXCEPTION", "INVALID_COMPLETION_REQUEST_EXCEPTION", "INVALID_FUNCTION_CALL_EXCEPTION", "INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION", "INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION", "INVALID_SQL_UNKNOWN_TABLE_EXCEPTION", "INVALID_TABLE_IDENTIFIER_EXCEPTION", "LOCAL_CONTEXT_EXCEEDED_EXCEPTION", "MESSAGE_ATTACHMENT_TOO_LONG_ERROR", "MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION", "MISSING_SQL_QUERY_EXCEPTION", "NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE", "NO_QUERY_TO_VISUALIZE_EXCEPTION", "NO_TABLES_TO_QUERY_EXCEPTION", "RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION", "RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION", "REPLY_PROCESS_TIMEOUT_EXCEPTION", "RETRYABLE_PROCESSING_EXCEPTION", "SQL_EXECUTION_EXCEPTION", "STOP_PROCESS_DUE_TO_AUTO_REGENERATE", "TABLES_MISSING_EXCEPTION", "TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION", "TOO_MANY_TABLES_EXCEPTION", "UNEXPECTED_REPLY_PROCESS_EXCEPTION", "UNKNOWN_AI_MODEL", "WAREHOUSE_ACCESS_MISSING_EXCEPTION", "WAREHOUSE_NOT_FOUND_EXCEPTION"`, v) + return fmt.Errorf(`value "%s" is not one of "BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION", "CHAT_COMPLETION_CLIENT_EXCEPTION", "CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION", "CHAT_COMPLETION_NETWORK_EXCEPTION", "CONTENT_FILTER_EXCEPTION", "CONTEXT_EXCEEDED_EXCEPTION", "COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION", "COULD_NOT_GET_UC_SCHEMA_EXCEPTION", "DEPLOYMENT_NOT_FOUND_EXCEPTION", "DESCRIBE_QUERY_INVALID_SQL_ERROR", "DESCRIBE_QUERY_TIMEOUT", "DESCRIBE_QUERY_UNEXPECTED_FAILURE", "EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION", "FUNCTIONS_NOT_AVAILABLE_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION", "FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION", "FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION", "GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION", "GENERIC_CHAT_COMPLETION_EXCEPTION", "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION", "GENERIC_SQL_EXEC_API_CALL_EXCEPTION", "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION", "INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION", "INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION", "INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION", "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION", "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION", "INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION", "INVALID_CHAT_COMPLETION_JSON_EXCEPTION", "INVALID_COMPLETION_REQUEST_EXCEPTION", "INVALID_FUNCTION_CALL_EXCEPTION", "INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION", "INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION", "INVALID_SQL_UNKNOWN_TABLE_EXCEPTION", "INVALID_TABLE_IDENTIFIER_EXCEPTION", "LOCAL_CONTEXT_EXCEEDED_EXCEPTION", "MESSAGE_ATTACHMENT_TOO_LONG_ERROR", "MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION", "MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION", "MISSING_SQL_QUERY_EXCEPTION", "NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE", "NO_QUERY_TO_VISUALIZE_EXCEPTION", "NO_TABLES_TO_QUERY_EXCEPTION", "RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION", "RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION", "REPLY_PROCESS_TIMEOUT_EXCEPTION", "RETRYABLE_PROCESSING_EXCEPTION", "SQL_EXECUTION_EXCEPTION", "STOP_PROCESS_DUE_TO_AUTO_REGENERATE", "TABLES_MISSING_EXCEPTION", "TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION", "TOO_MANY_TABLES_EXCEPTION", "UNEXPECTED_REPLY_PROCESS_EXCEPTION", "UNKNOWN_AI_MODEL", "UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION", "WAREHOUSE_ACCESS_MISSING_EXCEPTION", "WAREHOUSE_NOT_FOUND_EXCEPTION"`, v) } } @@ -1111,6 +1289,7 @@ func (f *MessageErrorType) Values() []MessageErrorType { MessageErrorTypeTooManyTablesException, MessageErrorTypeUnexpectedReplyProcessException, MessageErrorTypeUnknownAiModel, + MessageErrorTypeUnsupportedConversationTypeException, MessageErrorTypeWarehouseAccessMissingException, MessageErrorTypeWarehouseNotFoundException, } @@ -1240,6 +1419,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 +1503,68 @@ 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 ResponsePhase string + +const ResponsePhaseResponsePhaseThinking ResponsePhase = `RESPONSE_PHASE_THINKING` + +const ResponsePhaseResponsePhaseVerifying ResponsePhase = `RESPONSE_PHASE_VERIFYING` + +// String representation for [fmt.Print] +func (f *ResponsePhase) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ResponsePhase) Set(v string) error { + switch v { + case `RESPONSE_PHASE_THINKING`, `RESPONSE_PHASE_VERIFYING`: + *f = ResponsePhase(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "RESPONSE_PHASE_THINKING", "RESPONSE_PHASE_VERIFYING"`, v) + } +} + +// Values returns all possible values for ResponsePhase. +// +// There is no guarantee on the order of the values in the slice. +func (f *ResponsePhase) Values() []ResponsePhase { + return []ResponsePhase{ + ResponsePhaseResponsePhaseThinking, + ResponsePhaseResponsePhaseVerifying, + } +} + +// Type always returns ResponsePhase to satisfy [pflag.Value] interface +func (f *ResponsePhase) Type() string { + return "ResponsePhase" +} + type Result struct { // If result is truncated IsTruncated bool `json:"is_truncated,omitempty"` @@ -1448,12 +1712,37 @@ 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"` Id string `json:"id,omitempty"` + Phase ResponsePhase `json:"phase,omitempty"` + // Purpose/intent of this text attachment + Purpose TextAttachmentPurpose `json:"purpose,omitempty"` + // Metadata for verification phase attachments. Only set when phase = + // RESPONSE_PHASE_VERIFYING. + VerificationMetadata *VerificationMetadata `json:"verification_metadata,omitempty"` + ForceSendFields []string `json:"-" url:"-"` } @@ -1465,6 +1754,41 @@ func (s TextAttachment) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Purpose/intent of a text attachment +type TextAttachmentPurpose string + +const TextAttachmentPurposeFollowUpQuestion TextAttachmentPurpose = `FOLLOW_UP_QUESTION` + +// String representation for [fmt.Print] +func (f *TextAttachmentPurpose) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *TextAttachmentPurpose) Set(v string) error { + switch v { + case `FOLLOW_UP_QUESTION`: + *f = TextAttachmentPurpose(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "FOLLOW_UP_QUESTION"`, v) + } +} + +// Values returns all possible values for TextAttachmentPurpose. +// +// There is no guarantee on the order of the values in the slice. +func (f *TextAttachmentPurpose) Values() []TextAttachmentPurpose { + return []TextAttachmentPurpose{ + TextAttachmentPurposeFollowUpQuestion, + } +} + +// Type always returns TextAttachmentPurpose to satisfy [pflag.Value] interface +func (f *TextAttachmentPurpose) Type() string { + return "TextAttachmentPurpose" +} + type TrashDashboardRequest struct { // UUID identifying the dashboard. DashboardId string `json:"-" url:"-"` @@ -1489,3 +1813,67 @@ type UpdateScheduleRequest struct { // UUID identifying the schedule. ScheduleId string `json:"-" url:"-"` } + +// Metadata for verification phase attachments +type VerificationMetadata struct { + // Optional index to help order attachments within the same section + Index int `json:"index,omitempty"` + + Section VerificationSection `json:"section,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *VerificationMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s VerificationMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Verification workflow section - indicates which stage of verification this +// attachment belongs to These sections are used for grouping and ordering +// attachments in the frontend UI +type VerificationSection string + +const VerificationSectionVerificationSectionFinalDecision VerificationSection = `VERIFICATION_SECTION_FINAL_DECISION` + +const VerificationSectionVerificationSectionProposedImprovement VerificationSection = `VERIFICATION_SECTION_PROPOSED_IMPROVEMENT` + +const VerificationSectionVerificationSectionSqlExamplesValidation VerificationSection = `VERIFICATION_SECTION_SQL_EXAMPLES_VALIDATION` + +const VerificationSectionVerificationSectionVerificationQueries VerificationSection = `VERIFICATION_SECTION_VERIFICATION_QUERIES` + +// String representation for [fmt.Print] +func (f *VerificationSection) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *VerificationSection) Set(v string) error { + switch v { + case `VERIFICATION_SECTION_FINAL_DECISION`, `VERIFICATION_SECTION_PROPOSED_IMPROVEMENT`, `VERIFICATION_SECTION_SQL_EXAMPLES_VALIDATION`, `VERIFICATION_SECTION_VERIFICATION_QUERIES`: + *f = VerificationSection(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "VERIFICATION_SECTION_FINAL_DECISION", "VERIFICATION_SECTION_PROPOSED_IMPROVEMENT", "VERIFICATION_SECTION_SQL_EXAMPLES_VALIDATION", "VERIFICATION_SECTION_VERIFICATION_QUERIES"`, v) + } +} + +// Values returns all possible values for VerificationSection. +// +// There is no guarantee on the order of the values in the slice. +func (f *VerificationSection) Values() []VerificationSection { + return []VerificationSection{ + VerificationSectionVerificationSectionFinalDecision, + VerificationSectionVerificationSectionProposedImprovement, + VerificationSectionVerificationSectionSqlExamplesValidation, + VerificationSectionVerificationSectionVerificationQueries, + } +} + +// Type always returns VerificationSection to satisfy [pflag.Value] interface +func (f *VerificationSection) Type() string { + return "VerificationSection" +} diff --git a/service/database/api.go b/service/database/api.go index 60788f020..e01535885 100755 --- a/service/database/api.go +++ b/service/database/api.go @@ -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) } diff --git a/service/database/impl.go b/service/database/impl.go index 3afe2c50f..dd19f2992 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -123,6 +123,17 @@ func (a *databaseImpl) DeleteSyncedDatabaseTable(ctx context.Context, request De return err } +func (a *databaseImpl) FailoverDatabaseInstance(ctx context.Context, request FailoverDatabaseInstanceRequest) (*DatabaseInstance, error) { + var databaseInstance DatabaseInstance + path := fmt.Sprintf("/api/2.0/database/instances/%v/failover", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseInstance) + return &databaseInstance, err +} + func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) { var databaseInstance DatabaseInstance path := "/api/2.0/database/instances:findByUid" @@ -399,6 +410,21 @@ func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request Updat return &databaseInstance, err } +func (a *databaseImpl) UpdateDatabaseInstanceRole(ctx context.Context, request UpdateDatabaseInstanceRoleRequest) (*DatabaseInstanceRole, error) { + var databaseInstanceRole DatabaseInstanceRole + path := fmt.Sprintf("/api/2.0/database/instances/%v/roles/%v", request.InstanceName, request.Name) + queryParams := make(map[string]any) + + if request.DatabaseInstanceName != "" || slices.Contains(request.ForceSendFields, "DatabaseInstanceName") { + queryParams["database_instance_name"] = request.DatabaseInstanceName + } + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseInstanceRole, &databaseInstanceRole) + return &databaseInstanceRole, err +} + func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request UpdateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) { var syncedDatabaseTable SyncedDatabaseTable path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", request.Name) diff --git a/service/database/interface.go b/service/database/interface.go index 38e9aa038..075d94294 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,9 @@ 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) } diff --git a/service/database/model.go b/service/database/model.go index fdf21c58b..fde78e822 100755 --- a/service/database/model.go +++ b/service/database/model.go @@ -62,10 +62,14 @@ func (s CustomTag) MarshalJSON() ([]byte, error) { 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"` @@ -425,6 +429,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:"-"` } @@ -492,6 +498,19 @@ type DeleteDatabaseTableRequest struct { type DeleteSyncedDatabaseTableRequest struct { Name string `json:"-" url:"-"` + // Optional. When set to true, the actual PostgreSQL table will be dropped + // from the database. + PurgeData bool `json:"-" url:"purge_data,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *DeleteSyncedDatabaseTableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s DeleteSyncedDatabaseTableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeltaTableSyncInfo struct { @@ -513,6 +532,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"` @@ -721,6 +756,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. // @@ -897,6 +934,8 @@ func (s RequestedResource) MarshalJSON() ([]byte, error) { 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 +943,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 +972,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 @@ -1286,6 +1333,27 @@ 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 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 bb3d1577e..ef325add9 100755 --- a/service/dataquality/model.go +++ b/service/dataquality/model.go @@ -73,6 +73,62 @@ 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. @@ -465,6 +521,8 @@ type InferenceLogConfig struct { ModelIdColumn string `json:"model_id_column"` // Column for the prediction. PredictionColumn string `json:"prediction_column"` + // Column for prediction probabilities + PredictionProbabilityColumn string `json:"prediction_probability_column,omitempty"` // Problem type the model aims to solve. ProblemType InferenceProblemType `json:"problem_type"` // Column for the timestamp. diff --git a/service/iam/api.go b/service/iam/api.go index e389310da..0d2c4d295 100755 --- a/service/iam/api.go +++ b/service/iam/api.go @@ -109,15 +109,19 @@ type AccountGroupsV2Interface interface { Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, error) // Gets all details of the groups associated with the Databricks account. As of - // 08/22/2025, this endpoint will not return members. Instead, members should be - // retrieved by iterating through `Get group details`. + // 08/22/2025, this endpoint will no longer return members. Instead, members + // should be retrieved by iterating through `Get group details`. Existing + // accounts that rely on this attribute will not be impacted and will continue + // receiving member data as before. // // This method is generated by Databricks SDK Code Generator. List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[AccountGroup] // Gets all details of the groups associated with the Databricks account. As of - // 08/22/2025, this endpoint will not return members. Instead, members should be - // retrieved by iterating through `Get group details`. + // 08/22/2025, this endpoint will no longer return members. Instead, members + // should be retrieved by iterating through `Get group details`. Existing + // accounts that rely on this attribute will not be impacted and will continue + // receiving member data as before. // // This method is generated by Databricks SDK Code Generator. ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]AccountGroup, error) diff --git a/service/iam/impl.go b/service/iam/impl.go index 1cf2aa32b..a07c5b79c 100755 --- a/service/iam/impl.go +++ b/service/iam/impl.go @@ -134,8 +134,10 @@ func (a *accountGroupsV2Impl) Get(ctx context.Context, request GetAccountGroupRe } // Gets all details of the groups associated with the Databricks account. As of -// 08/22/2025, this endpoint will not return members. Instead, members should be -// retrieved by iterating through `Get group details`. +// 08/22/2025, this endpoint will no longer return members. Instead, members +// should be retrieved by iterating through `Get group details`. Existing +// accounts that rely on this attribute will not be impacted and will continue +// receiving member data as before. func (a *accountGroupsV2Impl) List(ctx context.Context, request ListAccountGroupsRequest) listing.Iterator[AccountGroup] { request.StartIndex = 1 // SCIM offset starts from 1 @@ -165,8 +167,10 @@ func (a *accountGroupsV2Impl) List(ctx context.Context, request ListAccountGroup } // Gets all details of the groups associated with the Databricks account. As of -// 08/22/2025, this endpoint will not return members. Instead, members should be -// retrieved by iterating through `Get group details`. +// 08/22/2025, this endpoint will no longer return members. Instead, members +// should be retrieved by iterating through `Get group details`. Existing +// accounts that rely on this attribute will not be impacted and will continue +// receiving member data as before. func (a *accountGroupsV2Impl) ListAll(ctx context.Context, request ListAccountGroupsRequest) ([]AccountGroup, error) { iterator := a.List(ctx, request) return listing.ToSliceN[AccountGroup, int64](ctx, iterator, request.Count) diff --git a/service/iam/interface.go b/service/iam/interface.go index 5754a981c..3bf16c768 100755 --- a/service/iam/interface.go +++ b/service/iam/interface.go @@ -84,8 +84,10 @@ type AccountGroupsV2Service interface { Get(ctx context.Context, request GetAccountGroupRequest) (*AccountGroup, error) // Gets all details of the groups associated with the Databricks account. As - // of 08/22/2025, this endpoint will not return members. Instead, members - // should be retrieved by iterating through `Get group details`. + // of 08/22/2025, this endpoint will no longer return members. Instead, + // members should be retrieved by iterating through `Get group details`. + // Existing accounts that rely on this attribute will not be impacted and + // will continue receiving member data as before. List(ctx context.Context, request ListAccountGroupsRequest) (*ListAccountGroupsResponse, error) // Partially updates the details of a group. 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/api.go b/service/jobs/api.go index b5f4d48f9..77fd11392 100755 --- a/service/jobs/api.go +++ b/service/jobs/api.go @@ -244,7 +244,7 @@ func NewJobs(client *client.DatabricksClient) *JobsAPI { // Databricks manages the task orchestration, cluster management, monitoring, // and error reporting for all of your jobs. You can run your jobs immediately // or periodically through an easy-to-use scheduling system. You can implement -// job tasks using notebooks, JARS, Delta Live Tables pipelines, or Python, +// job tasks using notebooks, JARS, Spark Declarative Pipelines, or Python, // Scala, Spark submit, and Java applications. // // You should never hard code secrets or store them in plain text. Use the diff --git a/service/jobs/interface.go b/service/jobs/interface.go index 7b90299e4..c1c757af2 100755 --- a/service/jobs/interface.go +++ b/service/jobs/interface.go @@ -14,7 +14,7 @@ import ( // Databricks manages the task orchestration, cluster management, monitoring, // and error reporting for all of your jobs. You can run your jobs immediately // or periodically through an easy-to-use scheduling system. You can implement -// job tasks using notebooks, JARS, Delta Live Tables pipelines, or Python, +// job tasks using notebooks, JARS, Spark Declarative Pipelines, or Python, // Scala, Spark submit, and Java applications. // // You should never hard code secrets or store them in plain text. Use the diff --git a/service/jobs/model.go b/service/jobs/model.go index 3954a27d3..5fc3f97b7 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"` @@ -437,6 +441,9 @@ type CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput struct { NotebookOutput *NotebookOutput `json:"notebook_output,omitempty"` // Information on how to access the output schema for the clean room run OutputSchemaInfo *OutputSchemaInfo `json:"output_schema_info,omitempty"` + // Information on how to access the shared output schema for the clean room + // run + SharedOutputSchemaInfo *OutputSchemaInfo `json:"shared_output_schema_info,omitempty"` } type ClusterInstance struct { @@ -667,11 +674,12 @@ type CreateJob struct { // begin or complete as well as when this job is deleted. EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // A list of task execution environment specifications that can be - // referenced by serverless tasks of this job. An environment is required to - // be present for serverless tasks. For serverless notebook tasks, the - // environment is accessible in the notebook environment panel. For other - // serverless tasks, the task environment is required to be specified using - // environment_key in the task settings. + // referenced by serverless tasks of this job. For serverless notebook + // tasks, if the environment_key is not specified, the notebook environment + // will be used if present. If a jobs environment is specified, it will + // override the notebook environment. For other serverless tasks, the task + // environment is required to be specified using environment_key in the task + // settings. Environments []JobEnvironment `json:"environments,omitempty"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is @@ -715,6 +723,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. // @@ -1626,6 +1637,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. @@ -2074,11 +2089,12 @@ type JobSettings struct { // begin or complete as well as when this job is deleted. EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // A list of task execution environment specifications that can be - // referenced by serverless tasks of this job. An environment is required to - // be present for serverless tasks. For serverless notebook tasks, the - // environment is accessible in the notebook environment panel. For other - // serverless tasks, the task environment is required to be specified using - // environment_key in the task settings. + // referenced by serverless tasks of this job. For serverless notebook + // tasks, if the environment_key is not specified, the notebook environment + // will be used if present. If a jobs environment is specified, it will + // override the notebook environment. For other serverless tasks, the task + // environment is required to be specified using environment_key in the task + // settings. Environments []JobEnvironment `json:"environments,omitempty"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is @@ -2122,6 +2138,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. // @@ -2541,6 +2560,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). @@ -4267,6 +4357,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 @@ -5060,6 +5153,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"` @@ -5226,7 +5322,7 @@ type TableUpdateTriggerConfiguration struct { MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` // 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"` + TableNames []string `json:"table_names"` // 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 // table updates before triggering a run. The minimum allowed value is 60 @@ -5809,6 +5905,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 2ce87a5c9..211252233 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) @@ -356,6 +359,9 @@ func (a *ExperimentsAPI) GetPermissionsByExperimentId(ctx context.Context, exper type FeatureEngineeringInterface interface { + // Batch create materialized features. + BatchCreateMaterializedFeatures(ctx context.Context, request BatchCreateMaterializedFeaturesRequest) (*BatchCreateMaterializedFeaturesResponse, error) + // Create a Feature. CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) diff --git a/service/ml/impl.go b/service/ml/impl.go index 08bfd6aaa..e33acadf1 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) @@ -592,6 +602,17 @@ type featureEngineeringImpl struct { client *client.DatabricksClient } +func (a *featureEngineeringImpl) BatchCreateMaterializedFeatures(ctx context.Context, request BatchCreateMaterializedFeaturesRequest) (*BatchCreateMaterializedFeaturesResponse, error) { + var batchCreateMaterializedFeaturesResponse BatchCreateMaterializedFeaturesResponse + path := "/api/2.0/feature-engineering/materialized-features:batchCreate" + 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, &batchCreateMaterializedFeaturesResponse) + return &batchCreateMaterializedFeaturesResponse, err +} + func (a *featureEngineeringImpl) CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) { var feature Feature path := "/api/2.0/feature-engineering/features" diff --git a/service/ml/interface.go b/service/ml/interface.go index 7f2471d83..e17a7a42a 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) @@ -257,6 +260,9 @@ type ExperimentsService interface { // Deprecated: Do not use this interface, it will be removed in a future version of the SDK. type FeatureEngineeringService interface { + // Batch create materialized features. + BatchCreateMaterializedFeatures(ctx context.Context, request BatchCreateMaterializedFeaturesRequest) (*BatchCreateMaterializedFeaturesResponse, error) + // Create a Feature. CreateFeature(ctx context.Context, request CreateFeatureRequest) (*Feature, error) diff --git a/service/ml/model.go b/service/ml/model.go index 190633a41..1f5ddb5bc 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -238,6 +238,16 @@ type ApproveTransitionRequestResponse struct { Activity *Activity `json:"activity,omitempty"` } +type BatchCreateMaterializedFeaturesRequest struct { + // The requests to create materialized features. + Requests []CreateMaterializedFeatureRequest `json:"requests"` +} + +type BatchCreateMaterializedFeaturesResponse struct { + // The created materialized features with assigned IDs. + MaterializedFeatures []MaterializedFeature `json:"materialized_features,omitempty"` +} + // An action that a user (with sufficient permissions) could take on an activity // or comment. // @@ -1160,6 +1170,13 @@ type Feature struct { Function Function `json:"function"` // The input columns from which the feature is computed. Inputs []string `json:"inputs"` + // WARNING: This field is primarily intended for internal use by Databricks + // systems and is automatically populated when features are created through + // Databricks notebooks or jobs. Users should not manually set this field as + // incorrect values may lead to inaccurate lineage tracking or unexpected + // behavior. This field will be set by feature-engineering client and should + // be left unset by SDK and terraform users. + LineageContext *LineageContext `json:"lineage_context,omitempty"` // The data source of the feature. Source DataSource `json:"source"` // The time window in which the feature is computed. @@ -1551,6 +1568,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 GetMaterializedFeatureRequest struct { // The ID of the materialized feature. MaterializedFeatureId string `json:"-" url:"-"` @@ -1727,6 +1754,23 @@ type InputTag struct { Value string `json:"value"` } +type JobContext struct { + // The job ID where this API invoked. + JobId int64 `json:"job_id,omitempty"` + // The job run ID where this API was invoked. + JobRunId int64 `json:"job_run_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *JobContext) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s JobContext) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type JobSpec struct { // The personal access token used to authorize webhook's job runs. AccessToken string `json:"access_token"` @@ -1767,6 +1811,26 @@ func (s JobSpecWithoutSecret) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Lineage context information for tracking where an API was invoked. This will +// allow us to track lineage, which currently uses caller entity information for +// use across the Lineage Client and Observability in Lumberjack. +type LineageContext struct { + // Job context information including job ID and run ID. + JobContext *JobContext `json:"job_context,omitempty"` + // The notebook ID where this API was invoked. + NotebookId int64 `json:"notebook_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *LineageContext) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s LineageContext) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Feature for model version. ([ML-57150] Renamed from Feature to LinkedFeature) type LinkedFeature struct { // Feature name @@ -2411,7 +2475,7 @@ type MaterializedFeature struct { OfflineStoreConfig *OfflineStoreConfig `json:"offline_store_config,omitempty"` - OnlineStoreConfig *OnlineStore `json:"online_store_config,omitempty"` + OnlineStoreConfig *OnlineStoreConfig `json:"online_store_config,omitempty"` // The schedule state of the materialization pipeline. PipelineScheduleState MaterializedFeaturePipelineScheduleState `json:"pipeline_schedule_state,omitempty"` // The fully qualified Unity Catalog path to the table containing the @@ -2800,6 +2864,20 @@ func (s OnlineStore) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Configuration for online store destination. +type OnlineStoreConfig struct { + // The Unity Catalog catalog name. This name is also used as the Lakebase + // logical database name. + CatalogName string `json:"catalog_name"` + // The name of the target online store. + OnlineStoreName string `json:"online_store_name"` + // The Unity Catalog schema name. + SchemaName string `json:"schema_name"` + // Prefix for Unity Catalog table name. The materialized feature will be + // stored in a Lakebase table with this prefix and a generated postfix. + TableNamePrefix string `json:"table_name_prefix"` +} + type OnlineStoreState string const OnlineStoreStateAvailable OnlineStoreState = `AVAILABLE` diff --git a/service/pipelines/api.go b/service/pipelines/api.go index d843e562a..31c80fafb 100755 --- a/service/pipelines/api.go +++ b/service/pipelines/api.go @@ -1,19 +1,20 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -// The Delta Live Tables API allows you to create, edit, delete, start, and view -// details about pipelines. +// The Lakeflow Spark Declarative Pipelines API allows you to create, edit, +// delete, start, and view details about pipelines. // -// Delta Live Tables is a framework for building reliable, maintainable, and -// testable data processing pipelines. You define the transformations to perform -// on your data, and Delta Live Tables manages task orchestration, cluster -// management, monitoring, data quality, and error handling. +// Spark Declarative Pipelines is a framework for building reliable, +// maintainable, and testable data processing pipelines. You define the +// transformations to perform on your data, and Spark Declarative Pipelines +// manages task orchestration, cluster management, monitoring, data quality, and +// error handling. // // Instead of defining your data pipelines using a series of separate Apache -// Spark tasks, Delta Live Tables manages how your data is transformed based on -// a target schema you define for each processing step. You can also enforce -// data quality with Delta Live Tables expectations. Expectations allow you to -// define expected data quality and specify how to handle records that fail -// those expectations. +// Spark tasks, Spark Declarative Pipelines manages how your data is transformed +// based on a target schema you define for each processing step. You can also +// enforce data quality with Spark Declarative Pipelines expectations. +// Expectations allow you to define expected data quality and specify how to +// handle records that fail those expectations. package pipelines import ( @@ -33,16 +34,22 @@ 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) - // Deletes a pipeline. Deleting a pipeline is a permanent action that stops and - // removes the pipeline and its tables. You cannot undo this action. + // Deletes a pipeline. If the pipeline publishes to Unity Catalog, pipeline + // deletion will cascade to all pipeline tables. Please reach out to Databricks + // support for assistance to undo this action. Delete(ctx context.Context, request DeletePipelineRequest) error - // Deletes a pipeline. Deleting a pipeline is a permanent action that stops and - // removes the pipeline and its tables. You cannot undo this action. + // Deletes a pipeline. If the pipeline publishes to Unity Catalog, pipeline + // deletion will cascade to all pipeline tables. Please reach out to Databricks + // support for assistance to undo this action. DeleteByPipelineId(ctx context.Context, pipelineId string) error // Get a pipeline. @@ -84,12 +91,12 @@ type PipelinesInterface interface { // Retrieves events for a pipeline. ListPipelineEventsByPipelineId(ctx context.Context, pipelineId string) (*ListPipelineEventsResponse, error) - // Lists pipelines defined in the Delta Live Tables system. + // Lists pipelines defined in the Spark Declarative Pipelines system. // // This method is generated by Databricks SDK Code Generator. ListPipelines(ctx context.Context, request ListPipelinesRequest) listing.Iterator[PipelineStateInfo] - // Lists pipelines defined in the Delta Live Tables system. + // Lists pipelines defined in the Spark Declarative Pipelines system. // // This method is generated by Databricks SDK Code Generator. ListPipelinesAll(ctx context.Context, request ListPipelinesRequest) ([]PipelineStateInfo, error) @@ -118,6 +125,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. @@ -156,20 +167,21 @@ func NewPipelines(client *client.DatabricksClient) *PipelinesAPI { } } -// The Delta Live Tables API allows you to create, edit, delete, start, and view -// details about pipelines. +// The Lakeflow Spark Declarative Pipelines API allows you to create, edit, +// delete, start, and view details about pipelines. // -// Delta Live Tables is a framework for building reliable, maintainable, and -// testable data processing pipelines. You define the transformations to perform -// on your data, and Delta Live Tables manages task orchestration, cluster -// management, monitoring, data quality, and error handling. +// Spark Declarative Pipelines is a framework for building reliable, +// maintainable, and testable data processing pipelines. You define the +// transformations to perform on your data, and Spark Declarative Pipelines +// manages task orchestration, cluster management, monitoring, data quality, and +// error handling. // // Instead of defining your data pipelines using a series of separate Apache -// Spark tasks, Delta Live Tables manages how your data is transformed based on -// a target schema you define for each processing step. You can also enforce -// data quality with Delta Live Tables expectations. Expectations allow you to -// define expected data quality and specify how to handle records that fail -// those expectations. +// Spark tasks, Spark Declarative Pipelines manages how your data is transformed +// based on a target schema you define for each processing step. You can also +// enforce data quality with Spark Declarative Pipelines expectations. +// Expectations allow you to define expected data quality and specify how to +// handle records that fail those expectations. type PipelinesAPI struct { pipelinesImpl } @@ -228,8 +240,9 @@ func (w *WaitGetPipelineIdle[R]) GetWithTimeout(timeout time.Duration) (*GetPipe return w.Poll(timeout, w.callback) } -// Deletes a pipeline. Deleting a pipeline is a permanent action that stops and -// removes the pipeline and its tables. You cannot undo this action. +// Deletes a pipeline. If the pipeline publishes to Unity Catalog, pipeline +// deletion will cascade to all pipeline tables. Please reach out to Databricks +// support for assistance to undo this action. func (a *PipelinesAPI) DeleteByPipelineId(ctx context.Context, pipelineId string) error { return a.pipelinesImpl.Delete(ctx, DeletePipelineRequest{ PipelineId: pipelineId, diff --git a/service/pipelines/impl.go b/service/pipelines/impl.go index 1147be7b8..0049d75b8 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" @@ -118,7 +128,7 @@ func (a *pipelinesImpl) internalListPipelineEvents(ctx context.Context, request return &listPipelineEventsResponse, err } -// Lists pipelines defined in the Delta Live Tables system. +// Lists pipelines defined in the Spark Declarative Pipelines system. func (a *pipelinesImpl) ListPipelines(ctx context.Context, request ListPipelinesRequest) listing.Iterator[PipelineStateInfo] { getNextPage := func(ctx context.Context, req ListPipelinesRequest) (*ListPipelinesResponse, error) { @@ -143,7 +153,7 @@ func (a *pipelinesImpl) ListPipelines(ctx context.Context, request ListPipelines return iterator } -// Lists pipelines defined in the Delta Live Tables system. +// Lists pipelines defined in the Spark Declarative Pipelines system. func (a *pipelinesImpl) ListPipelinesAll(ctx context.Context, request ListPipelinesRequest) ([]PipelineStateInfo, error) { iterator := a.ListPipelines(ctx, request) return listing.ToSlice[PipelineStateInfo](ctx, iterator) @@ -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..782fa8569 100755 --- a/service/pipelines/interface.go +++ b/service/pipelines/interface.go @@ -6,31 +6,37 @@ import ( "context" ) -// The Delta Live Tables API allows you to create, edit, delete, start, and view -// details about pipelines. +// The Lakeflow Spark Declarative Pipelines API allows you to create, edit, +// delete, start, and view details about pipelines. // -// Delta Live Tables is a framework for building reliable, maintainable, and -// testable data processing pipelines. You define the transformations to perform -// on your data, and Delta Live Tables manages task orchestration, cluster -// management, monitoring, data quality, and error handling. +// Spark Declarative Pipelines is a framework for building reliable, +// maintainable, and testable data processing pipelines. You define the +// transformations to perform on your data, and Spark Declarative Pipelines +// manages task orchestration, cluster management, monitoring, data quality, and +// error handling. // // Instead of defining your data pipelines using a series of separate Apache -// Spark tasks, Delta Live Tables manages how your data is transformed based on -// a target schema you define for each processing step. You can also enforce -// data quality with Delta Live Tables expectations. Expectations allow you to -// define expected data quality and specify how to handle records that fail -// those expectations. +// Spark tasks, Spark Declarative Pipelines manages how your data is transformed +// based on a target schema you define for each processing step. You can also +// enforce data quality with Spark Declarative Pipelines expectations. +// Expectations allow you to define expected data quality and specify how to +// handle records that fail those expectations. // // 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. Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) - // Deletes a pipeline. Deleting a pipeline is a permanent action that stops - // and removes the pipeline and its tables. You cannot undo this action. + // Deletes a pipeline. If the pipeline publishes to Unity Catalog, pipeline + // deletion will cascade to all pipeline tables. Please reach out to + // Databricks support for assistance to undo this action. Delete(ctx context.Context, request DeletePipelineRequest) error // Get a pipeline. @@ -49,12 +55,17 @@ type PipelinesService interface { // Retrieves events for a pipeline. ListPipelineEvents(ctx context.Context, request ListPipelineEventsRequest) (*ListPipelineEventsResponse, error) - // Lists pipelines defined in the Delta Live Tables system. + // Lists pipelines defined in the Spark Declarative Pipelines system. ListPipelines(ctx context.Context, request ListPipelinesRequest) (*ListPipelinesResponse, error) // 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 d3a5679d0..f14ec243c 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. @@ -465,6 +490,8 @@ type GetPipelineResponse struct { CreatorUserName string `json:"creator_user_name,omitempty"` // Serverless budget policy ID of this pipeline. EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` + // Serverless usage policy ID of the pipeline. + EffectiveUsagePolicyId string `json:"effective_usage_policy_id,omitempty"` // The health of a pipeline. Health GetPipelineResponseHealth `json:"health,omitempty"` // The last time the pipeline settings were modified or created. @@ -567,13 +594,16 @@ 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"` // Optional. The Unity Catalog-compatible name for the gateway storage // location. This is the destination to use for the data that is extracted - // by the gateway. Delta Live Tables system will automatically create the - // storage location under the catalog and schema. + // by the gateway. Spark Declarative Pipelines system will automatically + // create the storage location under the catalog and schema. GatewayStorageName string `json:"gateway_storage_name,omitempty"` // Required, Immutable. The name of the schema for the gateway pipelines's // storage location. @@ -595,6 +625,12 @@ type IngestionPipelineDefinition struct { // to communicate with the source. This is used with connectors for // applications like Salesforce, Workday, and so on. ConnectionName string `json:"connection_name,omitempty"` + // Immutable. If set to true, the pipeline will ingest tables from the UC + // foreign catalogs directly without the need to specify a UC connection or + // ingestion gateway. The `source_catalog` fields in objects of + // IngestionConfig are interpreted as the UC foreign catalogs to ingest + // from. + IngestFromUcForeignCatalog bool `json:"ingest_from_uc_foreign_catalog,omitempty"` // Immutable. Identifier for the gateway that is used by this ingestion // pipeline to communicate with the source database. This is used with // connectors to databases like SQL Server. @@ -1057,6 +1093,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. @@ -1798,6 +1837,58 @@ 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 { +} + +// Configuration for rewinding a specific dataset. +type RewindDatasetSpec struct { + // Whether to cascade the rewind to dependent datasets. Must be specified. + Cascade bool `json:"cascade,omitempty"` + // The identifier of the dataset (e.g., "main.foo.tbl1"). + Identifier string `json:"identifier,omitempty"` + // Whether to reset checkpoints for this dataset. + ResetCheckpoints bool `json:"reset_checkpoints,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *RewindDatasetSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s RewindDatasetSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Information about a rewind being requested for this pipeline or some of the +// datasets in it. +type RewindSpec struct { + // List of datasets to rewind with specific configuration for each. When not + // specified, all datasets will be rewound with cascade = true and + // reset_checkpoints = true. + Datasets []RewindDatasetSpec `json:"datasets,omitempty"` + // If true, this is a dry run and we should emit the RewindSummary but not + // perform the rewind. + DryRun bool `json:"dry_run,omitempty"` + // The base timestamp to rewind to. Must be specified. + RewindTimestamp string `json:"rewind_timestamp,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *RewindSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s RewindSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // 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. @@ -1948,6 +2039,9 @@ type StartUpdate struct { // Refresh on a table means that the states of the table will be reset // before the refresh. RefreshSelection []string `json:"refresh_selection,omitempty"` + // The information about the requested rewind operation. If specified this + // is a rewind mode update. + RewindSpec *RewindSpec `json:"rewind_spec,omitempty"` // If true, this update only validates the correctness of pipeline source // code but does not materialize or publish any datasets. ValidateOnly bool `json:"validate_only,omitempty"` @@ -2082,14 +2176,18 @@ 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"` // The SCD type to use to ingest the table. ScdType TableSpecificConfigScdType `json:"scd_type,omitempty"` // The column names specifying the logical order of events in the source - // data. Delta Live Tables uses this sequencing to handle change events that - // arrive out of order. + // data. Spark Declarative Pipelines uses this sequencing to handle change + // events that arrive out of order. SequenceBy []string `json:"sequence_by,omitempty"` // (Optional) Additional custom parameters for Workday Report WorkdayReportParameters *IngestionPipelineDefinitionWorkdayReportParameters `json:"workday_report_parameters,omitempty"` @@ -2163,6 +2261,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 @@ -2307,6 +2408,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..f3e8ad048 100755 --- a/service/pkg.go +++ b/service/pkg.go @@ -206,7 +206,7 @@ // // - [settings.PersonalComputeAPI]: The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources. // -// - [pipelines.PipelinesAPI]: The Delta Live Tables API allows you to create, edit, delete, start, and view details about pipelines. +// - [pipelines.PipelinesAPI]: The Lakeflow Spark Declarative Pipelines API allows you to create, edit, delete, start, and view details about pipelines. // // - [catalog.PoliciesAPI]: Attribute-Based Access Control (ABAC) provides high leverage governance for enforcing compliance policies in Unity Catalog. // @@ -216,6 +216,8 @@ // // - [compute.PolicyFamiliesAPI]: View available policy families. // +// - [postgres.PostgresAPI]: The Postgres API provides access to a Postgres database via REST API or direct SQL. +// // - [provisioning.PrivateAccessAPI]: These APIs manage private access settings for this account. // // - [marketplace.ProviderExchangeFiltersAPI]: Marketplace exchanges filters curate which groups can access an exchange. @@ -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. @@ -266,7 +270,7 @@ // // - [settings.RestrictWorkspaceAdminsAPI]: The Restrict Workspace Admins setting lets you control the capabilities of workspace admins. // -// - [catalog.RfaAPI]: Request for Access enables customers to request access to and manage access request destinations for Unity Catalog securables. +// - [catalog.RfaAPI]: Request for Access enables users to request access for Unity Catalog securables. // // - [catalog.SchemasAPI]: A schema (also called a database) is the second layer of Unity Catalog’s three-level namespace. // @@ -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. @@ -371,6 +379,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/ml" "github.com/databricks/databricks-sdk-go/service/oauth2" "github.com/databricks/databricks-sdk-go/service/pipelines" + "github.com/databricks/databricks-sdk-go/service/postgres" "github.com/databricks/databricks-sdk-go/service/provisioning" "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" @@ -496,6 +505,7 @@ var ( _ *compute.PolicyComplianceForClustersAPI = nil _ *jobs.PolicyComplianceForJobsAPI = nil _ *compute.PolicyFamiliesAPI = nil + _ *postgres.PostgresAPI = nil _ *provisioning.PrivateAccessAPI = nil _ *marketplace.ProviderExchangeFiltersAPI = nil _ *marketplace.ProviderExchangesAPI = nil @@ -510,6 +520,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 +554,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/postgres/api.go b/service/postgres/api.go new file mode 100755 index 000000000..8a16ce64c --- /dev/null +++ b/service/postgres/api.go @@ -0,0 +1,1051 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +// The Postgres API provides access to a Postgres database via REST API or +// direct SQL. +package postgres + +import ( + "context" + "encoding/json" + "fmt" + "time" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/retries" + "github.com/databricks/databricks-sdk-go/service/common/lro" + "github.com/databricks/databricks-sdk-go/useragent" +) + +type PostgresInterface interface { + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (CreateDatabaseBranchOperationInterface, error) + + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (CreateDatabaseEndpointOperationInterface, error) + + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (CreateDatabaseProjectOperationInterface, 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 Operation. + GetDatabaseOperation(ctx context.Context, request GetOperationRequest) (*Operation, 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 Projects. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) listing.Iterator[DatabaseProject] + + // List Database Projects. + // + // This method is generated by Databricks SDK Code Generator. + ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) + + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (RestartDatabaseEndpointOperationInterface, error) + + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (UpdateDatabaseBranchOperationInterface, error) + + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (UpdateDatabaseEndpointOperationInterface, error) + + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (UpdateDatabaseProjectOperationInterface, error) +} + +func NewPostgres(client *client.DatabricksClient) *PostgresAPI { + return &PostgresAPI{ + postgresImpl: postgresImpl{ + client: client, + }, + } +} + +// The Postgres API provides access to a Postgres database via REST API or +// direct SQL. +type PostgresAPI struct { + postgresImpl +} + +func (a *PostgresAPI) CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (CreateDatabaseBranchOperationInterface, error) { + operation, err := a.postgresImpl.CreateDatabaseBranch(ctx, request) + if err != nil { + return nil, err + } + return &CreateDatabaseBranchOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type CreateDatabaseBranchOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseBranch, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseBranchOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type CreateDatabaseBranchOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *CreateDatabaseBranchOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseBranch, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseBranch](ctx, timeout, func() (*DatabaseBranch, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseBranch DatabaseBranch + err = json.Unmarshal(operation.Response, &databaseBranch) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseBranch response: %w", err)) + } + + return &databaseBranch, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *CreateDatabaseBranchOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *CreateDatabaseBranchOperation) Metadata() (*DatabaseBranchOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseBranchOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *CreateDatabaseBranchOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (CreateDatabaseEndpointOperationInterface, error) { + operation, err := a.postgresImpl.CreateDatabaseEndpoint(ctx, request) + if err != nil { + return nil, err + } + return &CreateDatabaseEndpointOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type CreateDatabaseEndpointOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseEndpointOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type CreateDatabaseEndpointOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *CreateDatabaseEndpointOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseEndpoint](ctx, timeout, func() (*DatabaseEndpoint, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseEndpoint DatabaseEndpoint + err = json.Unmarshal(operation.Response, &databaseEndpoint) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseEndpoint response: %w", err)) + } + + return &databaseEndpoint, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *CreateDatabaseEndpointOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *CreateDatabaseEndpointOperation) Metadata() (*DatabaseEndpointOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseEndpointOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *CreateDatabaseEndpointOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (CreateDatabaseProjectOperationInterface, error) { + operation, err := a.postgresImpl.CreateDatabaseProject(ctx, request) + if err != nil { + return nil, err + } + return &CreateDatabaseProjectOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type CreateDatabaseProjectOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseProject, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseProjectOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type CreateDatabaseProjectOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *CreateDatabaseProjectOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseProject, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseProject](ctx, timeout, func() (*DatabaseProject, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseProject DatabaseProject + err = json.Unmarshal(operation.Response, &databaseProject) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseProject response: %w", err)) + } + + return &databaseProject, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *CreateDatabaseProjectOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *CreateDatabaseProjectOperation) Metadata() (*DatabaseProjectOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseProjectOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *CreateDatabaseProjectOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (RestartDatabaseEndpointOperationInterface, error) { + operation, err := a.postgresImpl.RestartDatabaseEndpoint(ctx, request) + if err != nil { + return nil, err + } + return &RestartDatabaseEndpointOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type RestartDatabaseEndpointOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseEndpointOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type RestartDatabaseEndpointOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *RestartDatabaseEndpointOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseEndpoint](ctx, timeout, func() (*DatabaseEndpoint, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseEndpoint DatabaseEndpoint + err = json.Unmarshal(operation.Response, &databaseEndpoint) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseEndpoint response: %w", err)) + } + + return &databaseEndpoint, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *RestartDatabaseEndpointOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *RestartDatabaseEndpointOperation) Metadata() (*DatabaseEndpointOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseEndpointOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *RestartDatabaseEndpointOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (UpdateDatabaseBranchOperationInterface, error) { + operation, err := a.postgresImpl.UpdateDatabaseBranch(ctx, request) + if err != nil { + return nil, err + } + return &UpdateDatabaseBranchOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type UpdateDatabaseBranchOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseBranch, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseBranchOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type UpdateDatabaseBranchOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *UpdateDatabaseBranchOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseBranch, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseBranch](ctx, timeout, func() (*DatabaseBranch, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseBranch DatabaseBranch + err = json.Unmarshal(operation.Response, &databaseBranch) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseBranch response: %w", err)) + } + + return &databaseBranch, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *UpdateDatabaseBranchOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *UpdateDatabaseBranchOperation) Metadata() (*DatabaseBranchOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseBranchOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *UpdateDatabaseBranchOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (UpdateDatabaseEndpointOperationInterface, error) { + operation, err := a.postgresImpl.UpdateDatabaseEndpoint(ctx, request) + if err != nil { + return nil, err + } + return &UpdateDatabaseEndpointOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type UpdateDatabaseEndpointOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseEndpointOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type UpdateDatabaseEndpointOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *UpdateDatabaseEndpointOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseEndpoint, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseEndpoint](ctx, timeout, func() (*DatabaseEndpoint, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseEndpoint DatabaseEndpoint + err = json.Unmarshal(operation.Response, &databaseEndpoint) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseEndpoint response: %w", err)) + } + + return &databaseEndpoint, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *UpdateDatabaseEndpointOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *UpdateDatabaseEndpointOperation) Metadata() (*DatabaseEndpointOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseEndpointOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *UpdateDatabaseEndpointOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} + +func (a *PostgresAPI) UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (UpdateDatabaseProjectOperationInterface, error) { + operation, err := a.postgresImpl.UpdateDatabaseProject(ctx, request) + if err != nil { + return nil, err + } + return &UpdateDatabaseProjectOperation{ + impl: &a.postgresImpl, + operation: operation, + }, nil +} + +type UpdateDatabaseProjectOperationInterface interface { + // Wait blocks until the long-running operation is completed with default 20 min + // timeout, the timeout can be overridden in the opts. If the operation didn't + // finished within the timeout, this function will through an error of type + // ErrTimedOut, otherwise successful response and any errors encountered. + Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseProject, error) + + // Name returns the name of the long-running operation. The name is assigned + // by the server and is unique within the service from which the operation is created. + Name() string + + // Metadata returns metadata associated with the long-running operation. + // If the metadata is not available, the returned metadata and error are both nil. + Metadata() (*DatabaseProjectOperationMetadata, error) + + // Done reports whether the long-running operation has completed. + Done() (bool, error) +} + +type UpdateDatabaseProjectOperation struct { + impl *postgresImpl + operation *Operation +} + +// Wait blocks until the long-running operation is completed with default 20 min +// timeout, the timeout can be overridden in the opts. If the operation didn't +// finished within the timeout, this function will through an error of type +// ErrTimedOut, otherwise successful response and any errors encountered. +func (a *UpdateDatabaseProjectOperation) Wait(ctx context.Context, opts *lro.LroOptions) (*DatabaseProject, error) { + timeout := 20 * time.Minute // default timeout per LRO spec + if opts != nil && opts.Timeout > 0 { + timeout = opts.Timeout + } + + ctx = useragent.InContext(ctx, "sdk-feature", "long-running") + val, err := retries.Poll[DatabaseProject](ctx, timeout, func() (*DatabaseProject, *retries.Err) { + operation, err := a.impl.GetDatabaseOperation(ctx, GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return nil, retries.Halt(err) + } + + // Update local operation state + a.operation = operation + + if !operation.Done { + return nil, retries.Continues("operation still in progress") + } + + if operation.Error != nil { + var errorMsg string + if operation.Error.Message != "" { + errorMsg = operation.Error.Message + } else { + errorMsg = "unknown error" + } + + if operation.Error.ErrorCode != "" { + errorMsg = fmt.Sprintf("[%s] %s", operation.Error.ErrorCode, errorMsg) + } + + return nil, retries.Halt(fmt.Errorf("operation failed: %s", errorMsg)) + } + + // Operation completed successfully, unmarshal response + if operation.Response == nil { + return nil, retries.Halt(fmt.Errorf("operation completed but no response available")) + } + + var databaseProject DatabaseProject + err = json.Unmarshal(operation.Response, &databaseProject) + if err != nil { + return nil, retries.Halt(fmt.Errorf("failed to unmarshal databaseProject response: %w", err)) + } + + return &databaseProject, nil + + }) + + if err != nil { + return nil, err + } + return val, nil + +} + +// Name returns the name of the long-running operation. The name is assigned +// by the server and is unique within the service from which the operation is created. +func (a *UpdateDatabaseProjectOperation) Name() string { + return a.operation.Name +} + +// Metadata returns metadata associated with the long-running operation. +// If the metadata is not available, the returned metadata and error are both nil. +func (a *UpdateDatabaseProjectOperation) Metadata() (*DatabaseProjectOperationMetadata, error) { + if a.operation.Metadata == nil { + return nil, nil + } + + var metadata DatabaseProjectOperationMetadata + err := json.Unmarshal(a.operation.Metadata, &metadata) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal operation metadata: %w", err) + } + + return &metadata, nil +} + +// Done reports whether the long-running operation has completed. +func (a *UpdateDatabaseProjectOperation) Done() (bool, error) { + // Refresh the operation state first + operation, err := a.impl.GetDatabaseOperation(context.Background(), GetOperationRequest{ + Name: a.operation.Name, + }) + if err != nil { + return false, err + } + + // Update local operation state + a.operation = operation + + return operation.Done, nil +} diff --git a/service/postgres/impl.go b/service/postgres/impl.go new file mode 100755 index 000000000..234f49af5 --- /dev/null +++ b/service/postgres/impl.go @@ -0,0 +1,310 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package postgres + +import ( + "context" + "fmt" + "net/http" + + "github.com/databricks/databricks-sdk-go/client" + "github.com/databricks/databricks-sdk-go/listing" + "github.com/databricks/databricks-sdk-go/useragent" + "golang.org/x/exp/slices" +) + +// unexported type that holds implementations of just Postgres API methods +type postgresImpl struct { + client *client.DatabricksClient +} + +func (a *postgresImpl) CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v/branches", request.Parent) + queryParams := make(map[string]any) + + if request.DatabaseBranchId != "" || slices.Contains(request.ForceSendFields, "DatabaseBranchId") { + queryParams["database_branch_id"] = request.DatabaseBranchId + } + 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, &operation) + return &operation, err +} + +func (a *postgresImpl) CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v/endpoints", request.Parent) + queryParams := make(map[string]any) + + if request.DatabaseEndpointId != "" || slices.Contains(request.ForceSendFields, "DatabaseEndpointId") { + queryParams["database_endpoint_id"] = request.DatabaseEndpointId + } + 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, &operation) + return &operation, err +} + +func (a *postgresImpl) CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*Operation, error) { + var operation Operation + path := "/api/2.0/postgres/projects" + queryParams := make(map[string]any) + + if request.DatabaseProjectId != "" || slices.Contains(request.ForceSendFields, "DatabaseProjectId") { + queryParams["database_project_id"] = request.DatabaseProjectId + } + 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, &operation) + return &operation, err +} + +func (a *postgresImpl) DeleteDatabaseBranch(ctx context.Context, request DeleteDatabaseBranchRequest) error { + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *postgresImpl) DeleteDatabaseEndpoint(ctx context.Context, request DeleteDatabaseEndpointRequest) error { + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *postgresImpl) DeleteDatabaseProject(ctx context.Context, request DeleteDatabaseProjectRequest) error { + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) + return err +} + +func (a *postgresImpl) GetDatabaseBranch(ctx context.Context, request GetDatabaseBranchRequest) (*DatabaseBranch, error) { + var databaseBranch DatabaseBranch + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseBranch) + return &databaseBranch, err +} + +func (a *postgresImpl) GetDatabaseEndpoint(ctx context.Context, request GetDatabaseEndpointRequest) (*DatabaseEndpoint, error) { + var databaseEndpoint DatabaseEndpoint + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseEndpoint) + return &databaseEndpoint, err +} + +func (a *postgresImpl) GetDatabaseOperation(ctx context.Context, request GetOperationRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) + return &operation, err +} + +func (a *postgresImpl) GetDatabaseProject(ctx context.Context, request GetDatabaseProjectRequest) (*DatabaseProject, error) { + var databaseProject DatabaseProject + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseProject) + return &databaseProject, err +} + +// List Database Branches. +func (a *postgresImpl) 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 *postgresImpl) ListDatabaseBranchesAll(ctx context.Context, request ListDatabaseBranchesRequest) ([]DatabaseBranch, error) { + iterator := a.ListDatabaseBranches(ctx, request) + return listing.ToSlice[DatabaseBranch](ctx, iterator) +} + +func (a *postgresImpl) internalListDatabaseBranches(ctx context.Context, request ListDatabaseBranchesRequest) (*ListDatabaseBranchesResponse, error) { + var listDatabaseBranchesResponse ListDatabaseBranchesResponse + path := fmt.Sprintf("/api/2.0/postgres/%v/branches", request.Parent) + 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 *postgresImpl) 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 *postgresImpl) ListDatabaseEndpointsAll(ctx context.Context, request ListDatabaseEndpointsRequest) ([]DatabaseEndpoint, error) { + iterator := a.ListDatabaseEndpoints(ctx, request) + return listing.ToSlice[DatabaseEndpoint](ctx, iterator) +} + +func (a *postgresImpl) internalListDatabaseEndpoints(ctx context.Context, request ListDatabaseEndpointsRequest) (*ListDatabaseEndpointsResponse, error) { + var listDatabaseEndpointsResponse ListDatabaseEndpointsResponse + path := fmt.Sprintf("/api/2.0/postgres/%v/endpoints", request.Parent) + 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 Projects. +func (a *postgresImpl) 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 Projects. +func (a *postgresImpl) ListDatabaseProjectsAll(ctx context.Context, request ListDatabaseProjectsRequest) ([]DatabaseProject, error) { + iterator := a.ListDatabaseProjects(ctx, request) + return listing.ToSlice[DatabaseProject](ctx, iterator) +} + +func (a *postgresImpl) internalListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) { + var listDatabaseProjectsResponse ListDatabaseProjectsResponse + path := "/api/2.0/postgres/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 *postgresImpl) RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + queryParams := make(map[string]any) + headers := make(map[string]string) + headers["Accept"] = "application/json" + headers["Content-Type"] = "application/json" + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &operation) + return &operation, err +} + +func (a *postgresImpl) UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + 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, &operation) + return &operation, err +} + +func (a *postgresImpl) UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + 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, &operation) + return &operation, err +} + +func (a *postgresImpl) UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*Operation, error) { + var operation Operation + path := fmt.Sprintf("/api/2.0/postgres/%v", request.Name) + 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, &operation) + return &operation, err +} diff --git a/service/postgres/interface.go b/service/postgres/interface.go new file mode 100755 index 000000000..8c52842ad --- /dev/null +++ b/service/postgres/interface.go @@ -0,0 +1,65 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package postgres + +import ( + "context" +) + +// The Postgres API provides access to a Postgres 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 PostgresService interface { + + // Create a Database Branch. + CreateDatabaseBranch(ctx context.Context, request CreateDatabaseBranchRequest) (*Operation, error) + + // Create a Database Endpoint. + CreateDatabaseEndpoint(ctx context.Context, request CreateDatabaseEndpointRequest) (*Operation, error) + + // Create a Database Project. + CreateDatabaseProject(ctx context.Context, request CreateDatabaseProjectRequest) (*Operation, 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 Operation. + GetDatabaseOperation(ctx context.Context, request GetOperationRequest) (*Operation, 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 Projects. + ListDatabaseProjects(ctx context.Context, request ListDatabaseProjectsRequest) (*ListDatabaseProjectsResponse, error) + + // Restart a Database Endpoint. + RestartDatabaseEndpoint(ctx context.Context, request RestartDatabaseEndpointRequest) (*Operation, error) + + // Update a Database Branch. + UpdateDatabaseBranch(ctx context.Context, request UpdateDatabaseBranchRequest) (*Operation, error) + + // Update a Database Endpoint. + UpdateDatabaseEndpoint(ctx context.Context, request UpdateDatabaseEndpointRequest) (*Operation, error) + + // Update a Database Project. + UpdateDatabaseProject(ctx context.Context, request UpdateDatabaseProjectRequest) (*Operation, error) +} diff --git a/service/postgres/model.go b/service/postgres/model.go new file mode 100755 index 000000000..f206c1dbe --- /dev/null +++ b/service/postgres/model.go @@ -0,0 +1,960 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package postgres + +import ( + "encoding/json" + "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" +) + +type CreateDatabaseBranchRequest struct { + // The Database Branch to create. + DatabaseBranch DatabaseBranch `json:"database_branch"` + // The ID to use for the Database Branch, which will become the final + // component of the branch's resource name. + // + // This value should be 4-63 characters, and valid characters are + // /[a-z][0-9]-/. + DatabaseBranchId string `json:"-" url:"database_branch_id,omitempty"` + // The Database Project where this Database Branch will be created. Format: + // projects/{project_id} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateDatabaseBranchRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateDatabaseBranchRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateDatabaseEndpointRequest struct { + // The Database Endpoint to create. + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + // The ID to use for the Database Endpoint, which will become the final + // component of the endpoint's resource name. + // + // This value should be 4-63 characters, and valid characters are + // /[a-z][0-9]-/. + DatabaseEndpointId string `json:"-" url:"database_endpoint_id,omitempty"` + // The Database Branch where this Database Endpoint will be created. Format: + // projects/{project_id}/branches/{branch_id} + Parent string `json:"-" url:"-"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateDatabaseEndpointRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateDatabaseEndpointRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type CreateDatabaseProjectRequest struct { + // The Database Project to create + DatabaseProject DatabaseProject `json:"database_project"` + // The ID to use for the Database Project, which will become the final + // component of the project's resource name. + // + // This value should be 4-63 characters, and valid characters are + // /[a-z][0-9]-/. + DatabaseProjectId string `json:"-" url:"database_project_id,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *CreateDatabaseProjectRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s CreateDatabaseProjectRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type DatabaseBranch struct { + // 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 resource name of the branch. Format: + // projects/{project_id}/branches/{branch_id} + Name string `json:"name,omitempty"` + // The parent to list branches from. Format: projects/{project_id} + Parent string `json:"parent,omitempty"` + // The parent branch Format: projects/{project_id}/branches/{branch_id} + ParentBranch string `json:"parent_branch,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. + ParentBranchLsn string `json:"parent_branch_lsn,omitempty"` + // The point in time on the parent branch from which this branch was + // created. + ParentBranchTime string `json:"parent_branch_time,omitempty"` + + PendingState string `json:"pending_state,omitempty"` + // 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 DatabaseBranchOperationMetadata struct { +} + +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"` + // 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"` + // 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"` + // The resource name of the endpoint. Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + Name string `json:"name,omitempty"` + // The parent to list endpoints from. Format: + // projects/{project_id}/branches/{branch_id} + Parent string `json:"parent,omitempty"` + + PendingState DatabaseEndpointState `json:"pending_state,omitempty"` + + PoolerMode DatabaseEndpointPoolerMode `json:"pooler_mode,omitempty"` + + 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) +} + +type DatabaseEndpointOperationMetadata struct { +} + +// 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" +} + +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 resource name of the project. Format: projects/{project_id} + Name string `json:"name,omitempty"` + // The major Postgres version number. + PgVersion int `json:"pg_version,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 DatabaseProjectOperationMetadata struct { +} + +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) +} + +// Databricks Error that is returned by all Databricks APIs. +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) +} + +type DeleteDatabaseBranchRequest struct { + // The name of the Database Branch to delete. Format: + // projects/{project_id}/branches/{branch_id} + Name string `json:"-" url:"-"` +} + +type DeleteDatabaseEndpointRequest struct { + // The name of the Database Endpoint to delete. Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + Name string `json:"-" url:"-"` +} + +type DeleteDatabaseProjectRequest struct { + // The name of the Database Project to delete. Format: projects/{project_id} + Name string `json:"-" url:"-"` +} + +// Legacy definition of the ErrorCode enum. Please keep in sync with +// api-base/proto/error_code.proto (except status code mapping annotations as +// this file doesn't have them). Will be removed eventually, pending the ScalaPB +// 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 GetDatabaseBranchRequest struct { + // The name of the Database Branch to retrieve. Format: + // projects/{project_id}/branches/{branch_id} + Name string `json:"-" url:"-"` +} + +type GetDatabaseEndpointRequest struct { + // The name of the Database Endpoint to retrieve. Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + Name string `json:"-" url:"-"` +} + +type GetDatabaseProjectRequest struct { + // The name of the Database Project to retrieve. Format: + // projects/{project_id} + Name string `json:"-" url:"-"` +} + +type GetOperationRequest struct { + // The name of the operation resource. + 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"` + // The Database Project, which owns this collection of branches. Format: + // projects/{project_id} + Parent 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 ListDatabaseEndpointsRequest 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"` + // The Database Branch, which owns this collection of endpoints. Format: + // projects/{project_id}/branches/{branch_id} + Parent 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 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) +} + +// 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. + 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}`. + Name string `json:"name,omitempty"` + // The normal, successful response of the operation. + 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) +} + +type RestartDatabaseEndpointRequest struct { + // The name of the Database Endpoint to restart. Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + Name string `json:"-" url:"-"` +} + +type UpdateDatabaseBranchRequest struct { + // The Database Branch to update. + // + // The branch's `name` field is used to identify the branch to update. + // Format: projects/{project_id}/branches/{branch_id} + DatabaseBranch DatabaseBranch `json:"database_branch"` + // The resource name of the branch. Format: + // projects/{project_id}/branches/{branch_id} + Name 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 UpdateDatabaseEndpointRequest struct { + // The Database Endpoint to update. + // + // The endpoints's `name` field is used to identify the endpoint to update. + // Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + DatabaseEndpoint DatabaseEndpoint `json:"database_endpoint"` + // The resource name of the endpoint. Format: + // projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id} + Name 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 UpdateDatabaseProjectRequest struct { + // The Database Project to update. + // + // The project's `name` field is used to identify the project to update. + // Format: projects/{project_id} + DatabaseProject DatabaseProject `json:"database_project"` + // The resource name of the project. Format: projects/{project_id} + Name string `json:"-" url:"-"` + // The list of fields to update. If unspecified, all fields will be updated + // when possible. + UpdateMask string `json:"-" url:"update_mask"` +} 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 6a34a10b8..bbf29a8d7 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -620,6 +620,10 @@ type CreatePrivateEndpointRule struct { // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. EndpointService string `json:"endpoint_service,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to @@ -661,6 +665,8 @@ type CreateTokenRequest struct { // // If the lifetime is not specified, this token remains valid indefinitely. LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` + // Optional scopes of the token. + Scopes []string `json:"scopes,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -808,6 +814,10 @@ func (s CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) MarshalJS type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState string +const CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateCreateFailed CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState = `CREATE_FAILED` + +const CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateCreating CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState = `CREATING` + const CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateDisconnected CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState = `DISCONNECTED` const CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateEstablished CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState = `ESTABLISHED` @@ -826,11 +836,11 @@ func (f *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLin // Set raw string value and validate it against allowed values func (f *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState) Set(v string) error { switch v { - case `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `PENDING`, `REJECTED`: + case `CREATE_FAILED`, `CREATING`, `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `PENDING`, `REJECTED`: *f = CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DISCONNECTED", "ESTABLISHED", "EXPIRED", "PENDING", "REJECTED"`, v) + return fmt.Errorf(`value "%s" is not one of "CREATE_FAILED", "CREATING", "DISCONNECTED", "ESTABLISHED", "EXPIRED", "PENDING", "REJECTED"`, v) } } @@ -839,6 +849,8 @@ func (f *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLin // There is no guarantee on the order of the values in the slice. func (f *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState) Values() []CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState { return []CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState{ + CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateCreateFailed, + CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateCreating, CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateDisconnected, CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateEstablished, CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionStateExpired, @@ -2350,6 +2362,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"` @@ -3308,6 +3338,10 @@ func (s NccAzurePrivateEndpointRule) MarshalJSON() ([]byte, error) { type NccAzurePrivateEndpointRuleConnectionState string +const NccAzurePrivateEndpointRuleConnectionStateCreateFailed NccAzurePrivateEndpointRuleConnectionState = `CREATE_FAILED` + +const NccAzurePrivateEndpointRuleConnectionStateCreating NccAzurePrivateEndpointRuleConnectionState = `CREATING` + const NccAzurePrivateEndpointRuleConnectionStateDisconnected NccAzurePrivateEndpointRuleConnectionState = `DISCONNECTED` const NccAzurePrivateEndpointRuleConnectionStateEstablished NccAzurePrivateEndpointRuleConnectionState = `ESTABLISHED` @@ -3328,11 +3362,11 @@ func (f *NccAzurePrivateEndpointRuleConnectionState) String() string { // Set raw string value and validate it against allowed values func (f *NccAzurePrivateEndpointRuleConnectionState) Set(v string) error { switch v { - case `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `INIT`, `PENDING`, `REJECTED`: + case `CREATE_FAILED`, `CREATING`, `DISCONNECTED`, `ESTABLISHED`, `EXPIRED`, `INIT`, `PENDING`, `REJECTED`: *f = NccAzurePrivateEndpointRuleConnectionState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "DISCONNECTED", "ESTABLISHED", "EXPIRED", "INIT", "PENDING", "REJECTED"`, v) + return fmt.Errorf(`value "%s" is not one of "CREATE_FAILED", "CREATING", "DISCONNECTED", "ESTABLISHED", "EXPIRED", "INIT", "PENDING", "REJECTED"`, v) } } @@ -3341,6 +3375,8 @@ func (f *NccAzurePrivateEndpointRuleConnectionState) Set(v string) error { // There is no guarantee on the order of the values in the slice. func (f *NccAzurePrivateEndpointRuleConnectionState) Values() []NccAzurePrivateEndpointRuleConnectionState { return []NccAzurePrivateEndpointRuleConnectionState{ + NccAzurePrivateEndpointRuleConnectionStateCreateFailed, + NccAzurePrivateEndpointRuleConnectionStateCreating, NccAzurePrivateEndpointRuleConnectionStateDisconnected, NccAzurePrivateEndpointRuleConnectionStateEstablished, NccAzurePrivateEndpointRuleConnectionStateExpired, @@ -3393,6 +3429,8 @@ type NccEgressDefaultRules struct { AwsStableIpRule *NccAwsStableIpRule `json:"aws_stable_ip_rule,omitempty"` AzureServiceEndpointRule *NccAzureServiceEndpointRule `json:"azure_service_endpoint_rule,omitempty"` + + GcpProjectIdRule *NetworkConnectivityConfigEgressConfigDefaultRuleGcpProjectIdRule `json:"gcp_project_id_rule,omitempty"` } // Target rule controls the egress rules that are dedicated to specific @@ -3445,6 +3483,10 @@ type NccPrivateEndpointRule struct { // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. EndpointService string `json:"endpoint_service,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to @@ -3534,6 +3576,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 @@ -3722,6 +3771,11 @@ type PublicTokenInfo struct { // Server time (in epoch milliseconds) when the token will expire, or -1 if // not applicable. ExpiryTime int64 `json:"expiry_time,omitempty"` + // Server time (in epoch milliseconds) when the token was accessed most + // recently. + LastAccessedTime int64 `json:"last_accessed_time,omitempty"` + // Scope of the token was created with, if applicable. + Scopes []string `json:"scopes,omitempty"` // The ID of this token. TokenId string `json:"token_id,omitempty"` @@ -3954,6 +4008,8 @@ type TokenInfo struct { LastUsedDay int64 `json:"last_used_day,omitempty"` // User ID of the user that owns the token. OwnerId int64 `json:"owner_id,omitempty"` + // Scope of the token was created with, if applicable. + Scopes []string `json:"scopes,omitempty"` // ID of the token. TokenId string `json:"token_id,omitempty"` // If applicable, the ID of the workspace that the token was created in. @@ -4632,6 +4688,10 @@ type UpdatePrivateEndpointRule struct { // Update this field to activate/deactivate this private endpoint to allow // egress access from serverless compute resources. Enabled bool `json:"enabled,omitempty"` + + ErrorMessage string `json:"error_message,omitempty"` + + GcpEndpointSpec *GcpEndpointSpec `json:"gcp_endpoint_spec,omitempty"` // Only used by private endpoints towards AWS S3 service. // // The globally unique S3 bucket names that will be accessed via the VPC diff --git a/service/sharing/api.go b/service/sharing/api.go index 6f6bc2ea6..b9ed26c43 100755 --- a/service/sharing/api.go +++ b/service/sharing/api.go @@ -290,6 +290,10 @@ type RecipientFederationPoliciesInterface interface { // from Databricks to non-Databricks recipients. The caller must have read // access to the recipient. ListByRecipientName(ctx context.Context, recipientName string) (*ListFederationPoliciesResponse, error) + + // Updates an existing federation policy for an OIDC_RECIPIENT. The caller must + // be the owner of the recipient. + Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) } func NewRecipientFederationPolicies(client *client.DatabricksClient) *RecipientFederationPoliciesAPI { diff --git a/service/sharing/impl.go b/service/sharing/impl.go index d22875458..f77956266 100755 --- a/service/sharing/impl.go +++ b/service/sharing/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 Providers API methods @@ -267,6 +268,21 @@ func (a *recipientFederationPoliciesImpl) internalList(ctx context.Context, requ return &listFederationPoliciesResponse, err } +func (a *recipientFederationPoliciesImpl) Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) { + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) + queryParams := make(map[string]any) + + 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" + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err +} + // unexported type that holds implementations of just Recipients API methods type recipientsImpl struct { client *client.DatabricksClient diff --git a/service/sharing/interface.go b/service/sharing/interface.go index 29356370f..7b2b10960 100755 --- a/service/sharing/interface.go +++ b/service/sharing/interface.go @@ -142,6 +142,10 @@ type RecipientFederationPoliciesService interface { // data from Databricks to non-Databricks recipients. The caller must have // read access to the recipient. List(ctx context.Context, request ListFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) + + // Updates an existing federation policy for an OIDC_RECIPIENT. The caller + // must be the owner of the recipient. + Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) } // A recipient is an object you create using :method:recipients/create to diff --git a/service/sharing/model.go b/service/sharing/model.go index 84bc758be..70c037ca4 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -223,6 +223,11 @@ type CreateShare struct { Comment string `json:"comment,omitempty"` // Name of the share. Name string `json:"name"` + // Whether replication is enabled for this share. + ReplicationEnabled bool `json:"replication_enabled,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"` @@ -950,6 +955,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 +1149,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 +1427,11 @@ type ShareInfo struct { Objects []SharedDataObject `json:"objects,omitempty"` // Username of current owner of share. Owner string `json:"owner,omitempty"` + // Whether replication is enabled for this share. + ReplicationEnabled bool `json:"replication_enabled,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. @@ -1905,6 +1928,33 @@ func (f *TableInternalAttributesSharedTableType) Type() string { return "TableInternalAttributesSharedTableType" } +type UpdateFederationPolicyRequest struct { + // Name of the policy. This is the name of the current name of the policy. + Name string `json:"-" url:"-"` + + Policy FederationPolicy `json:"policy"` + // Name of the recipient. This is the name of the recipient for which the + // policy is being updated. + RecipientName string `json:"-" url:"-"` + // The field mask specifies which fields of the policy to update. To specify + // multiple fields in the field mask, use comma as the separator (no space). + // The special value '*' indicates that all fields should be updated (full + // replacement). If unspecified, all fields that are set in the policy + // provided in the update request will overwrite the corresponding fields in + // the existing policy. Example value: 'comment,oidc_policy.audiences'. + UpdateMask string `json:"-" url:"update_mask,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type UpdateProvider struct { // Description about the provider. Comment string `json:"comment,omitempty"` @@ -1968,6 +2018,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 798890445..6ddf2d0fb 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -505,6 +505,9 @@ type AlertV2 struct { CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. DisplayName string `json:"display_name"` + // The actual workspace path of the folder containing the alert. This is an + // output-only field. + EffectiveParentPath string `json:"effective_parent_path,omitempty"` // The actual identity that will be used to execute the alert. This is an // output-only field that shows the resolved run-as identity after applying // permissions and defaults. @@ -611,6 +614,7 @@ type AlertV2Operand struct { } type AlertV2OperandColumn struct { + // If not set, the behavior is equivalent to using `First row` in the UI. Aggregation Aggregation `json:"aggregation,omitempty"` Display string `json:"display,omitempty"` @@ -1349,6 +1353,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..b07e004b3 100755 --- a/service/vectorsearch/api.go +++ b/service/vectorsearch/api.go @@ -53,6 +53,12 @@ type VectorSearchEndpointsInterface interface { // This method is generated by Databricks SDK Code Generator. ListEndpointsAll(ctx context.Context, request ListEndpointsRequest) ([]EndpointInfo, error) + // Update the throughput (concurrency) of an endpoint + PatchEndpointThroughput(ctx context.Context, request PatchEndpointThroughputRequest) (*PatchEndpointThroughputResponse, error) + + // Retrieve user-visible metrics for an endpoint + RetrieveUserVisibleMetrics(ctx context.Context, request RetrieveUserVisibleMetricsRequest) (*RetrieveUserVisibleMetricsResponse, error) + // Update the budget policy of an endpoint UpdateEndpointBudgetPolicy(ctx context.Context, request PatchEndpointBudgetPolicyRequest) (*PatchEndpointBudgetPolicyResponse, error) @@ -235,6 +241,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..7d2df9721 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -88,6 +88,28 @@ func (a *vectorSearchEndpointsImpl) internalListEndpoints(ctx context.Context, r return &listEndpointResponse, err } +func (a *vectorSearchEndpointsImpl) PatchEndpointThroughput(ctx context.Context, request PatchEndpointThroughputRequest) (*PatchEndpointThroughputResponse, error) { + var patchEndpointThroughputResponse PatchEndpointThroughputResponse + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/throughput", request.EndpointName) + 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, &patchEndpointThroughputResponse) + return &patchEndpointThroughputResponse, err +} + +func (a *vectorSearchEndpointsImpl) RetrieveUserVisibleMetrics(ctx context.Context, request RetrieveUserVisibleMetricsRequest) (*RetrieveUserVisibleMetricsResponse, error) { + var retrieveUserVisibleMetricsResponse RetrieveUserVisibleMetricsResponse + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/metrics", 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, &retrieveUserVisibleMetricsResponse) + return &retrieveUserVisibleMetricsResponse, err +} + func (a *vectorSearchEndpointsImpl) UpdateEndpointBudgetPolicy(ctx context.Context, request PatchEndpointBudgetPolicyRequest) (*PatchEndpointBudgetPolicyResponse, error) { var patchEndpointBudgetPolicyResponse PatchEndpointBudgetPolicyResponse path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/budget-policy", request.EndpointName) @@ -238,6 +260,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..e98e424dd 100755 --- a/service/vectorsearch/interface.go +++ b/service/vectorsearch/interface.go @@ -23,6 +23,12 @@ type VectorSearchEndpointsService interface { // List all vector search endpoints in the workspace. ListEndpoints(ctx context.Context, request ListEndpointsRequest) (*ListEndpointResponse, error) + // Update the throughput (concurrency) of an endpoint + PatchEndpointThroughput(ctx context.Context, request PatchEndpointThroughputRequest) (*PatchEndpointThroughputResponse, error) + + // Retrieve user-visible metrics for an endpoint + RetrieveUserVisibleMetrics(ctx context.Context, request RetrieveUserVisibleMetricsRequest) (*RetrieveUserVisibleMetricsResponse, error) + // Update the budget policy of an endpoint UpdateEndpointBudgetPolicy(ctx context.Context, request PatchEndpointBudgetPolicyRequest) (*PatchEndpointBudgetPolicyResponse, error) @@ -73,6 +79,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..f0dd39611 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -8,9 +8,31 @@ import ( "github.com/databricks/databricks-sdk-go/marshal" ) +// Adjusted throughput request parameters +type AdjustedThroughputRequest struct { + // Adjusted concurrency (total CPU) for the endpoint + Concurrency float64 `json:"concurrency,omitempty"` + // Adjusted maximum concurrency allowed for the endpoint + MaximumConcurrencyAllowed float64 `json:"maximum_concurrency_allowed,omitempty"` + // Adjusted minimum concurrency allowed for the endpoint + MinimalConcurrencyAllowed float64 `json:"minimal_concurrency_allowed,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *AdjustedThroughputRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s AdjustedThroughputRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ColumnInfo struct { // Name of the column. Name string `json:"name,omitempty"` + // Data type of the column (e.g., "string", "int", "array") + TypeText string `json:"type_text,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -30,6 +52,11 @@ type CreateEndpoint struct { EndpointType EndpointType `json:"endpoint_type"` // Name of the vector search endpoint Name string `json:"name"` + // Initial number of replicas for the endpoint. If not specified, defaults + // to 1. + NumReplicas int `json:"num_replicas,omitempty"` + // 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 +191,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 +225,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. @@ -309,6 +344,8 @@ type EndpointInfo struct { Name string `json:"name,omitempty"` // Number of indexes on the endpoint NumIndexes int `json:"num_indexes,omitempty"` + // Throughput information for the endpoint + ThroughputInfo *EndpointThroughputInfo `json:"throughput_info,omitempty"` ForceSendFields []string `json:"-" url:"-"` } @@ -348,6 +385,10 @@ const EndpointStatusStateOnline EndpointStatusState = `ONLINE` const EndpointStatusStateProvisioning EndpointStatusState = `PROVISIONING` +const EndpointStatusStateRedState EndpointStatusState = `RED_STATE` + +const EndpointStatusStateYellowState EndpointStatusState = `YELLOW_STATE` + // String representation for [fmt.Print] func (f *EndpointStatusState) String() string { return string(*f) @@ -356,11 +397,11 @@ func (f *EndpointStatusState) String() string { // Set raw string value and validate it against allowed values func (f *EndpointStatusState) Set(v string) error { switch v { - case `OFFLINE`, `ONLINE`, `PROVISIONING`: + case `OFFLINE`, `ONLINE`, `PROVISIONING`, `RED_STATE`, `YELLOW_STATE`: *f = EndpointStatusState(v) return nil default: - return fmt.Errorf(`value "%s" is not one of "OFFLINE", "ONLINE", "PROVISIONING"`, v) + return fmt.Errorf(`value "%s" is not one of "OFFLINE", "ONLINE", "PROVISIONING", "RED_STATE", "YELLOW_STATE"`, v) } } @@ -372,6 +413,8 @@ func (f *EndpointStatusState) Values() []EndpointStatusState { EndpointStatusStateOffline, EndpointStatusStateOnline, EndpointStatusStateProvisioning, + EndpointStatusStateRedState, + EndpointStatusStateYellowState, } } @@ -380,6 +423,38 @@ func (f *EndpointStatusState) Type() string { return "EndpointStatusState" } +// Throughput information for an endpoint +type EndpointThroughputInfo struct { + // Additional information about the throughput change request + ChangeRequestMessage string `json:"change_request_message,omitempty"` + // The state of the most recent throughput change request + ChangeRequestState ThroughputChangeRequestState `json:"change_request_state,omitempty"` + // The current concurrency (total CPU) allocated to the endpoint + CurrentConcurrency float64 `json:"current_concurrency,omitempty"` + // The current utilization of concurrency as a percentage (0-100) + CurrentConcurrencyUtilizationPercentage float64 `json:"current_concurrency_utilization_percentage,omitempty"` + // The current number of replicas allocated to the endpoint + CurrentNumReplicas int `json:"current_num_replicas,omitempty"` + // The maximum concurrency allowed for this endpoint + MaximumConcurrencyAllowed float64 `json:"maximum_concurrency_allowed,omitempty"` + // The minimum concurrency allowed for this endpoint + MinimalConcurrencyAllowed float64 `json:"minimal_concurrency_allowed,omitempty"` + // The requested concurrency (total CPU) for the endpoint + RequestedConcurrency float64 `json:"requested_concurrency,omitempty"` + // The requested number of replicas for the endpoint + RequestedNumReplicas int `json:"requested_num_replicas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *EndpointThroughputInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s EndpointThroughputInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Type of endpoint. type EndpointType string @@ -532,6 +607,70 @@ func (s MapStringValueEntry) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Metric specification +type Metric struct { + // Metric labels + Labels []MetricLabel `json:"labels,omitempty"` + // Metric name + Name string `json:"name,omitempty"` + // Percentile for the metric + Percentile float64 `json:"percentile,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *Metric) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s Metric) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Label for a metric +type MetricLabel struct { + // Label name + Name string `json:"name,omitempty"` + // Label value + Value string `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MetricLabel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MetricLabel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Single metric value at a specific timestamp +type MetricValue struct { + // Timestamp of the metric value (milliseconds since epoch) + Timestamp int64 `json:"timestamp,omitempty"` + // Metric value + Value float64 `json:"value,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *MetricValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s MetricValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Collection of metric values for a specific metric +type MetricValues struct { + // Metric specification + Metric *Metric `json:"metric,omitempty"` + // Time series of metric values + Values []MetricValue `json:"values,omitempty"` +} + type MiniVectorIndex struct { // The user who created the index. Creator string `json:"creator,omitempty"` @@ -578,6 +717,59 @@ func (s PatchEndpointBudgetPolicyResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type PatchEndpointThroughputRequest struct { + // If true, the request will fail if the requested concurrency or limits + // cannot be exactly met. If false, the request will be adjusted to the + // closest possible value. + AllOrNothing bool `json:"all_or_nothing,omitempty"` + // Requested concurrency (total CPU) for the endpoint. If not specified, the + // current concurrency is maintained. + Concurrency float64 `json:"concurrency,omitempty"` + // Name of the vector search endpoint + EndpointName string `json:"-" url:"-"` + // Maximum concurrency allowed for the endpoint. If not specified, the + // current maximum is maintained. + MaximumConcurrencyAllowed float64 `json:"maximum_concurrency_allowed,omitempty"` + // Minimum concurrency allowed for the endpoint. If not specified, the + // current minimum is maintained. + MinimalConcurrencyAllowed float64 `json:"minimal_concurrency_allowed,omitempty"` + // Requested number of data copies for the endpoint (including primary). For + // example: num_replicas=2 means 2 total copies of the data (1 primary + 1 + // replica). If not specified, the current replication factor is maintained. + // Valid range: 1-6 (where 1 = no replication, 6 = 1 primary + 5 replicas). + NumReplicas int `json:"num_replicas,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *PatchEndpointThroughputRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s PatchEndpointThroughputRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +type PatchEndpointThroughputResponse struct { + // The adjusted request if the original request could not be fully + // fulfilled. This is only populated when the request was adjusted. + AdjustedRequest *AdjustedThroughputRequest `json:"adjusted_request,omitempty"` + // Message explaining the status or any adjustments made + Message string `json:"message,omitempty"` + // The status of the throughput change request + Status ThroughputPatchStatus `json:"status,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *PatchEndpointThroughputResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s PatchEndpointThroughputResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + // Pipeline execution mode. - `TRIGGERED`: If the pipeline uses the triggered // execution mode, the system stops processing after successfully refreshing the // source table in the pipeline once, ensuring the table is updated based on the @@ -668,7 +860,8 @@ type QueryVectorIndexRequest struct { NumResults int `json:"num_results,omitempty"` // Query text. Required for Delta Sync Index using model endpoint. QueryText string `json:"query_text,omitempty"` - // The query type to use. Choices are `ANN` and `HYBRID`. Defaults to `ANN`. + // The query type to use. Choices are `ANN` and `HYBRID` and `FULL_TEXT`. + // Defaults to `ANN`. QueryType string `json:"query_type,omitempty"` // Query vector. Required for Direct Vector Access Index and Delta Sync // Index using self-managed vectors. @@ -767,6 +960,51 @@ func (s ResultManifest) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +// Request to retrieve user-visible metrics +type RetrieveUserVisibleMetricsRequest struct { + // End time for metrics query + EndTime string `json:"end_time,omitempty"` + // Granularity in seconds + GranularityInSeconds int `json:"granularity_in_seconds,omitempty"` + // List of metrics to retrieve + Metrics []Metric `json:"metrics,omitempty"` + // Vector search endpoint name + Name string `json:"-" url:"-"` + // Token for pagination + PageToken string `json:"page_token,omitempty"` + // Start time for metrics query + StartTime string `json:"start_time,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *RetrieveUserVisibleMetricsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s RetrieveUserVisibleMetricsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + +// Response containing user-visible metrics +type RetrieveUserVisibleMetricsResponse struct { + // Collection of metric values + MetricValues []MetricValues `json:"metric_values,omitempty"` + // A token that can be used to get the next page of results. If not present, + // there are no more results to show. + NextPageToken string `json:"next_page_token,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *RetrieveUserVisibleMetricsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s RetrieveUserVisibleMetricsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) +} + type ScanVectorIndexRequest struct { // Name of the vector index to scan. IndexName string `json:"-" url:"-"` @@ -814,6 +1052,97 @@ type SyncIndexRequest struct { IndexName string `json:"-" url:"-"` } +// Throughput change request state +type ThroughputChangeRequestState string + +const ThroughputChangeRequestStateChangeAdjusted ThroughputChangeRequestState = `CHANGE_ADJUSTED` + +const ThroughputChangeRequestStateChangeFailed ThroughputChangeRequestState = `CHANGE_FAILED` + +const ThroughputChangeRequestStateChangeInProgress ThroughputChangeRequestState = `CHANGE_IN_PROGRESS` + +const ThroughputChangeRequestStateChangeReachedMaximum ThroughputChangeRequestState = `CHANGE_REACHED_MAXIMUM` + +const ThroughputChangeRequestStateChangeReachedMinimum ThroughputChangeRequestState = `CHANGE_REACHED_MINIMUM` + +const ThroughputChangeRequestStateChangeSuccess ThroughputChangeRequestState = `CHANGE_SUCCESS` + +// String representation for [fmt.Print] +func (f *ThroughputChangeRequestState) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ThroughputChangeRequestState) Set(v string) error { + switch v { + case `CHANGE_ADJUSTED`, `CHANGE_FAILED`, `CHANGE_IN_PROGRESS`, `CHANGE_REACHED_MAXIMUM`, `CHANGE_REACHED_MINIMUM`, `CHANGE_SUCCESS`: + *f = ThroughputChangeRequestState(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "CHANGE_ADJUSTED", "CHANGE_FAILED", "CHANGE_IN_PROGRESS", "CHANGE_REACHED_MAXIMUM", "CHANGE_REACHED_MINIMUM", "CHANGE_SUCCESS"`, v) + } +} + +// Values returns all possible values for ThroughputChangeRequestState. +// +// There is no guarantee on the order of the values in the slice. +func (f *ThroughputChangeRequestState) Values() []ThroughputChangeRequestState { + return []ThroughputChangeRequestState{ + ThroughputChangeRequestStateChangeAdjusted, + ThroughputChangeRequestStateChangeFailed, + ThroughputChangeRequestStateChangeInProgress, + ThroughputChangeRequestStateChangeReachedMaximum, + ThroughputChangeRequestStateChangeReachedMinimum, + ThroughputChangeRequestStateChangeSuccess, + } +} + +// Type always returns ThroughputChangeRequestState to satisfy [pflag.Value] interface +func (f *ThroughputChangeRequestState) Type() string { + return "ThroughputChangeRequestState" +} + +// Response status for throughput change requests +type ThroughputPatchStatus string + +const ThroughputPatchStatusPatchAccepted ThroughputPatchStatus = `PATCH_ACCEPTED` + +const ThroughputPatchStatusPatchFailed ThroughputPatchStatus = `PATCH_FAILED` + +const ThroughputPatchStatusPatchRejected ThroughputPatchStatus = `PATCH_REJECTED` + +// String representation for [fmt.Print] +func (f *ThroughputPatchStatus) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ThroughputPatchStatus) Set(v string) error { + switch v { + case `PATCH_ACCEPTED`, `PATCH_FAILED`, `PATCH_REJECTED`: + *f = ThroughputPatchStatus(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "PATCH_ACCEPTED", "PATCH_FAILED", "PATCH_REJECTED"`, v) + } +} + +// Values returns all possible values for ThroughputPatchStatus. +// +// There is no guarantee on the order of the values in the slice. +func (f *ThroughputPatchStatus) Values() []ThroughputPatchStatus { + return []ThroughputPatchStatus{ + ThroughputPatchStatusPatchAccepted, + ThroughputPatchStatusPatchFailed, + ThroughputPatchStatusPatchRejected, + } +} + +// Type always returns ThroughputPatchStatus to satisfy [pflag.Value] interface +func (f *ThroughputPatchStatus) Type() string { + return "ThroughputPatchStatus" +} + type UpdateEndpointCustomTagsRequest struct { // The new custom tags for the vector search endpoint CustomTags []CustomTag `json:"custom_tags"` @@ -838,6 +1167,14 @@ func (s UpdateEndpointCustomTagsResponse) MarshalJSON() ([]byte, error) { return marshal.Marshal(s) } +type UpdateVectorIndexUsagePolicyRequest struct { + // Name of the vector search index + IndexName string `json:"-" url:"-"` +} + +type UpdateVectorIndexUsagePolicyResponse struct { +} + type UpsertDataResult struct { // List of primary keys for rows that failed to process. FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` diff --git a/service/workspace/model.go b/service/workspace/model.go index e31212d0a..503605878 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -357,6 +357,43 @@ func (f *ExportFormat) Type() string { return "ExportFormat" } +type ExportOutputs string + +const ExportOutputsAll ExportOutputs = `ALL` + +const ExportOutputsNone ExportOutputs = `NONE` + +// String representation for [fmt.Print] +func (f *ExportOutputs) String() string { + return string(*f) +} + +// Set raw string value and validate it against allowed values +func (f *ExportOutputs) Set(v string) error { + switch v { + case `ALL`, `NONE`: + *f = ExportOutputs(v) + return nil + default: + return fmt.Errorf(`value "%s" is not one of "ALL", "NONE"`, v) + } +} + +// Values returns all possible values for ExportOutputs. +// +// There is no guarantee on the order of the values in the slice. +func (f *ExportOutputs) Values() []ExportOutputs { + return []ExportOutputs{ + ExportOutputsAll, + ExportOutputsNone, + } +} + +// Type always returns ExportOutputs to satisfy [pflag.Value] interface +func (f *ExportOutputs) Type() string { + return "ExportOutputs" +} + type ExportRequest struct { // This specifies the format of the exported file. By default, this is // `SOURCE`. @@ -373,6 +410,12 @@ type ExportRequest struct { // on the objects type. Directory exports will include notebooks and // workspace files. Format ExportFormat `json:"-" url:"format,omitempty"` + // This specifies which cell outputs should be included in the export (if + // the export format allows it). If not specified, the behavior is + // determined by the format. For JUPYTER format, the default is to include + // all outputs. This is a public endpoint, but only ALL or NONE is + // documented publically, DATABRICKS is internal only + Outputs ExportOutputs `json:"-" url:"outputs,omitempty"` // The absolute path of the object or directory. Exporting a directory is // only supported for the `DBC`, `SOURCE`, and `AUTO` format. Path string `json:"-" url:"path"` diff --git a/workspace_client.go b/workspace_client.go index cf1c2a83f..8dab6a468 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -25,6 +25,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/ml" "github.com/databricks/databricks-sdk-go/service/oauth2" "github.com/databricks/databricks-sdk-go/service/pipelines" + "github.com/databricks/databricks-sdk-go/service/postgres" "github.com/databricks/databricks-sdk-go/service/qualitymonitorv2" "github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/settings" @@ -506,7 +507,7 @@ type WorkspaceClient struct { // management, monitoring, and error reporting for all of your jobs. You can // run your jobs immediately or periodically through an easy-to-use // scheduling system. You can implement job tasks using notebooks, JARS, - // Delta Live Tables pipelines, or Python, Scala, Spark submit, and Java + // Spark Declarative Pipelines, or Python, Scala, Spark submit, and Java // applications. // // You should never hard code secrets or store them in plain text. Use the @@ -638,20 +639,21 @@ type WorkspaceClient struct { // [Access Control]: https://docs.databricks.com/security/auth-authz/access-control/index.html Permissions iam.PermissionsInterface - // The Delta Live Tables API allows you to create, edit, delete, start, and - // view details about pipelines. + // The Lakeflow Spark Declarative Pipelines API allows you to create, edit, + // delete, start, and view details about pipelines. // - // Delta Live Tables is a framework for building reliable, maintainable, and - // testable data processing pipelines. You define the transformations to - // perform on your data, and Delta Live Tables manages task orchestration, - // cluster management, monitoring, data quality, and error handling. + // Spark Declarative Pipelines is a framework for building reliable, + // maintainable, and testable data processing pipelines. You define the + // transformations to perform on your data, and Spark Declarative Pipelines + // manages task orchestration, cluster management, monitoring, data quality, + // and error handling. // // Instead of defining your data pipelines using a series of separate Apache - // Spark tasks, Delta Live Tables manages how your data is transformed based - // on a target schema you define for each processing step. You can also - // enforce data quality with Delta Live Tables expectations. Expectations - // allow you to define expected data quality and specify how to handle - // records that fail those expectations. + // Spark tasks, Spark Declarative Pipelines manages how your data is + // transformed based on a target schema you define for each processing step. + // You can also enforce data quality with Spark Declarative Pipelines + // expectations. Expectations allow you to define expected data quality and + // specify how to handle records that fail those expectations. Pipelines pipelines.PipelinesInterface // Attribute-Based Access Control (ABAC) provides high leverage governance @@ -703,6 +705,10 @@ type WorkspaceClient struct { // using a policy family inherit the policy family's policy definition. PolicyFamilies compute.PolicyFamiliesInterface + // The Postgres API provides access to a Postgres database via REST API or + // direct SQL. + Postgres postgres.PostgresInterface + // Marketplace exchanges filters curate which groups can access an exchange. ProviderExchangeFilters marketplace.ProviderExchangeFiltersInterface @@ -764,6 +770,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 @@ -902,13 +911,11 @@ type WorkspaceClient struct { // [Unity Catalog documentation]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#resource-quotas ResourceQuotas catalog.ResourceQuotasInterface - // Request for Access enables customers to request access to and manage - // access request destinations for Unity Catalog securables. + // Request for Access enables users to request access for Unity Catalog + // securables. // - // These APIs provide a standardized way to update, get, and request to - // access request destinations. Fine-grained authorization ensures that only - // users with appropriate permissions can manage access request - // destinations. + // These APIs provide a standardized way for securable owners (or users with + // MANAGE privileges) to manage access request destinations. Rfa catalog.RfaInterface // A schema (also called a database) is the second layer of Unity @@ -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]. @@ -1451,6 +1461,7 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { PolicyComplianceForClusters: compute.NewPolicyComplianceForClusters(databricksClient), PolicyComplianceForJobs: jobs.NewPolicyComplianceForJobs(databricksClient), PolicyFamilies: compute.NewPolicyFamilies(databricksClient), + Postgres: postgres.NewPostgres(databricksClient), ProviderExchangeFilters: marketplace.NewProviderExchangeFilters(databricksClient), ProviderExchanges: marketplace.NewProviderExchanges(databricksClient), ProviderFiles: marketplace.NewProviderFiles(databricksClient), @@ -1463,6 +1474,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), @@ -1487,6 +1499,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),