// Code generated by mockery v2.35.2. DO NOT EDIT. package tests import ( context "context" apikey "github.com/grafana/grafana/pkg/services/apikey" mock "github.com/stretchr/testify/mock" serviceaccounts "github.com/grafana/grafana/pkg/services/serviceaccounts" ) // MockServiceAccountService is an autogenerated mock type for the Service type type MockServiceAccountService struct { mock.Mock } // AddServiceAccountToken provides a mock function with given fields: ctx, serviceAccountID, cmd func (_m *MockServiceAccountService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error) { ret := _m.Called(ctx, serviceAccountID, cmd) var r0 *apikey.APIKey var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error)); ok { return rf(ctx, serviceAccountID, cmd) } if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) *apikey.APIKey); ok { r0 = rf(ctx, serviceAccountID, cmd) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*apikey.APIKey) } } if rf, ok := ret.Get(1).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) error); ok { r1 = rf(ctx, serviceAccountID, cmd) } else { r1 = ret.Error(1) } return r0, r1 } // CreateServiceAccount provides a mock function with given fields: ctx, orgID, saForm func (_m *MockServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, saForm *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error) { ret := _m.Called(ctx, orgID, saForm) var r0 *serviceaccounts.ServiceAccountDTO var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error)); ok { return rf(ctx, orgID, saForm) } if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) *serviceaccounts.ServiceAccountDTO); ok { r0 = rf(ctx, orgID, saForm) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*serviceaccounts.ServiceAccountDTO) } } if rf, ok := ret.Get(1).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) error); ok { r1 = rf(ctx, orgID, saForm) } else { r1 = ret.Error(1) } return r0, r1 } // DeleteServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID func (_m *MockServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) error { ret := _m.Called(ctx, orgID, serviceAccountID) var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok { r0 = rf(ctx, orgID, serviceAccountID) } else { r0 = ret.Error(0) } return r0 } // DeleteServiceAccountToken provides a mock function with given fields: ctx, orgID, serviceAccountID, tokenID func (_m *MockServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID int64, serviceAccountID int64, tokenID int64) error { ret := _m.Called(ctx, orgID, serviceAccountID, tokenID) var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int64) error); ok { r0 = rf(ctx, orgID, serviceAccountID, tokenID) } else { r0 = ret.Error(0) } return r0 } // EnableServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, enable func (_m *MockServiceAccountService) EnableServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, enable bool) error { ret := _m.Called(ctx, orgID, serviceAccountID, enable) var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64, bool) error); ok { r0 = rf(ctx, orgID, serviceAccountID, enable) } else { r0 = ret.Error(0) } return r0 } // ListTokens provides a mock function with given fields: ctx, query func (_m *MockServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error) { ret := _m.Called(ctx, query) var r0 []apikey.APIKey var r1 error if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)); ok { return rf(ctx, query) } if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.GetSATokensQuery) []apikey.APIKey); ok { r0 = rf(ctx, query) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]apikey.APIKey) } } if rf, ok := ret.Get(1).(func(context.Context, *serviceaccounts.GetSATokensQuery) error); ok { r1 = rf(ctx, query) } else { r1 = ret.Error(1) } return r0, r1 } // MigrateApiKey provides a mock function with given fields: ctx, orgID, keyId func (_m *MockServiceAccountService) MigrateApiKey(ctx context.Context, orgID int64, keyId int64) error { ret := _m.Called(ctx, orgID, keyId) var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok { r0 = rf(ctx, orgID, keyId) } else { r0 = ret.Error(0) } return r0 } // MigrateApiKeysToServiceAccounts provides a mock function with given fields: ctx, orgID func (_m *MockServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error) { ret := _m.Called(ctx, orgID) var r0 *serviceaccounts.MigrationResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64) (*serviceaccounts.MigrationResult, error)); ok { return rf(ctx, orgID) } if rf, ok := ret.Get(0).(func(context.Context, int64) *serviceaccounts.MigrationResult); ok { r0 = rf(ctx, orgID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*serviceaccounts.MigrationResult) } } if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { r1 = rf(ctx, orgID) } else { r1 = ret.Error(1) } return r0, r1 } // RetrieveServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID func (_m *MockServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) (*serviceaccounts.ServiceAccountProfileDTO, error) { ret := _m.Called(ctx, orgID, serviceAccountID) var r0 *serviceaccounts.ServiceAccountProfileDTO var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64) (*serviceaccounts.ServiceAccountProfileDTO, error)); ok { return rf(ctx, orgID, serviceAccountID) } if rf, ok := ret.Get(0).(func(context.Context, int64, int64) *serviceaccounts.ServiceAccountProfileDTO); ok { r0 = rf(ctx, orgID, serviceAccountID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*serviceaccounts.ServiceAccountProfileDTO) } } if rf, ok := ret.Get(1).(func(context.Context, int64, int64) error); ok { r1 = rf(ctx, orgID, serviceAccountID) } else { r1 = ret.Error(1) } return r0, r1 } // RetrieveServiceAccountIdByName provides a mock function with given fields: ctx, orgID, name func (_m *MockServiceAccountService) RetrieveServiceAccountIdByName(ctx context.Context, orgID int64, name string) (int64, error) { ret := _m.Called(ctx, orgID, name) var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64, string) (int64, error)); ok { return rf(ctx, orgID, name) } if rf, ok := ret.Get(0).(func(context.Context, int64, string) int64); ok { r0 = rf(ctx, orgID, name) } else { r0 = ret.Get(0).(int64) } if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok { r1 = rf(ctx, orgID, name) } else { r1 = ret.Error(1) } return r0, r1 } // SearchOrgServiceAccounts provides a mock function with given fields: ctx, query func (_m *MockServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error) { ret := _m.Called(ctx, query) var r0 *serviceaccounts.SearchOrgServiceAccountsResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)); ok { return rf(ctx, query) } if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) *serviceaccounts.SearchOrgServiceAccountsResult); ok { r0 = rf(ctx, query) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*serviceaccounts.SearchOrgServiceAccountsResult) } } if rf, ok := ret.Get(1).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) error); ok { r1 = rf(ctx, query) } else { r1 = ret.Error(1) } return r0, r1 } // UpdateServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, saForm func (_m *MockServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, saForm *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error) { ret := _m.Called(ctx, orgID, serviceAccountID, saForm) var r0 *serviceaccounts.ServiceAccountProfileDTO var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error)); ok { return rf(ctx, orgID, serviceAccountID, saForm) } if rf, ok := ret.Get(0).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) *serviceaccounts.ServiceAccountProfileDTO); ok { r0 = rf(ctx, orgID, serviceAccountID, saForm) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*serviceaccounts.ServiceAccountProfileDTO) } } if rf, ok := ret.Get(1).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) error); ok { r1 = rf(ctx, orgID, serviceAccountID, saForm) } else { r1 = ret.Error(1) } return r0, r1 } // NewMockServiceAccountService creates a new instance of MockServiceAccountService. 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 NewMockServiceAccountService(t interface { mock.TestingT Cleanup(func()) }) *MockServiceAccountService { mock := &MockServiceAccountService{} mock.Mock.Test(t) t.Cleanup(func() { mock.AssertExpectations(t) }) return mock }