mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
b885da09da
* Implement run migration endpoint * Refactor RunMigration method into separate methods * Save migration runs fix lint * Minor changes * Refactor how to use cms endpoint * fix interface * complete merge * add individual items * adds tracing to getMigration * linter * updated swagger definition with the latest changes * CloudMigrations: Implement core API handlers for cloud migrations and migration runs (#85407) * implement delete * add auth token encryption * implement token validation * call token validation during migration creation * implement get migration status * implement list migration runs * fix bug * finish parse domain func * fix urls * fix typo * fix encoding and decoding * remove double decryption * add missing slash * fix id returned by create function * inject missing services * finish implementing (as far as I can tell right now) data migration and response handling * comment out broken test, needs a rewrite * add a few final touches * get dashboard migration to work properly * changed runMigration to a POST * swagger * swagger * swagger --------- Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com> Co-authored-by: Leonard Gram <leo@xlson.com> Co-authored-by: Michael Mandrus <41969079+mmandrus@users.noreply.github.com>
408 lines
11 KiB
Go
408 lines
11 KiB
Go
// Code generated by mockery v2.40.1. DO NOT EDIT.
|
|
|
|
package dashboards
|
|
|
|
import (
|
|
context "context"
|
|
|
|
identity "github.com/grafana/grafana/pkg/services/auth/identity"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
model "github.com/grafana/grafana/pkg/services/search/model"
|
|
)
|
|
|
|
// FakeDashboardService is an autogenerated mock type for the DashboardService type
|
|
type FakeDashboardService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// BuildSaveDashboardCommand provides a mock function with given fields: ctx, dto, validateProvisionedDashboard
|
|
func (_m *FakeDashboardService) BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, validateProvisionedDashboard bool) (*SaveDashboardCommand, error) {
|
|
ret := _m.Called(ctx, dto, validateProvisionedDashboard)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for BuildSaveDashboardCommand")
|
|
}
|
|
|
|
var r0 *SaveDashboardCommand
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool) (*SaveDashboardCommand, error)); ok {
|
|
return rf(ctx, dto, validateProvisionedDashboard)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool) *SaveDashboardCommand); ok {
|
|
r0 = rf(ctx, dto, validateProvisionedDashboard)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*SaveDashboardCommand)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO, bool) error); ok {
|
|
r1 = rf(ctx, dto, validateProvisionedDashboard)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountInFolders provides a mock function with given fields: ctx, orgID, folderUIDs, user
|
|
func (_m *FakeDashboardService) CountInFolders(ctx context.Context, orgID int64, folderUIDs []string, user identity.Requester) (int64, error) {
|
|
ret := _m.Called(ctx, orgID, folderUIDs, user)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountInFolders")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []string, identity.Requester) (int64, error)); ok {
|
|
return rf(ctx, orgID, folderUIDs, user)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []string, identity.Requester) int64); ok {
|
|
r0 = rf(ctx, orgID, folderUIDs, user)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, []string, identity.Requester) error); ok {
|
|
r1 = rf(ctx, orgID, folderUIDs, user)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DeleteDashboard provides a mock function with given fields: ctx, dashboardId, orgId
|
|
func (_m *FakeDashboardService) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error {
|
|
ret := _m.Called(ctx, dashboardId, orgId)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteDashboard")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
|
|
r0 = rf(ctx, dashboardId, orgId)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FindDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) FindDashboards(ctx context.Context, query *FindPersistedDashboardsQuery) ([]DashboardSearchProjection, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindDashboards")
|
|
}
|
|
|
|
var r0 []DashboardSearchProjection
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *FindPersistedDashboardsQuery) ([]DashboardSearchProjection, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *FindPersistedDashboardsQuery) []DashboardSearchProjection); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]DashboardSearchProjection)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *FindPersistedDashboardsQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetAllDashboards provides a mock function with given fields: ctx
|
|
func (_m *FakeDashboardService) GetAllDashboards(ctx context.Context) ([]*Dashboard, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetAllDashboards")
|
|
}
|
|
|
|
var r0 []*Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) ([]*Dashboard, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) []*Dashboard); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboard provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboard(ctx context.Context, query *GetDashboardQuery) (*Dashboard, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetDashboard")
|
|
}
|
|
|
|
var r0 *Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardQuery) (*Dashboard, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardQuery) *Dashboard); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *GetDashboardQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboardTags provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboardTags(ctx context.Context, query *GetDashboardTagsQuery) ([]*DashboardTagCloudItem, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetDashboardTags")
|
|
}
|
|
|
|
var r0 []*DashboardTagCloudItem
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardTagsQuery) ([]*DashboardTagCloudItem, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardTagsQuery) []*DashboardTagCloudItem); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*DashboardTagCloudItem)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *GetDashboardTagsQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboardUIDByID provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboardUIDByID(ctx context.Context, query *GetDashboardRefByIDQuery) (*DashboardRef, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetDashboardUIDByID")
|
|
}
|
|
|
|
var r0 *DashboardRef
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardRefByIDQuery) (*DashboardRef, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardRefByIDQuery) *DashboardRef); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*DashboardRef)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *GetDashboardRefByIDQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboards(ctx context.Context, query *GetDashboardsQuery) ([]*Dashboard, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetDashboards")
|
|
}
|
|
|
|
var r0 []*Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardsQuery) ([]*Dashboard, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *GetDashboardsQuery) []*Dashboard); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *GetDashboardsQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboardsSharedWithUser provides a mock function with given fields: ctx, user
|
|
func (_m *FakeDashboardService) GetDashboardsSharedWithUser(ctx context.Context, user identity.Requester) ([]*Dashboard, error) {
|
|
ret := _m.Called(ctx, user)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetDashboardsSharedWithUser")
|
|
}
|
|
|
|
var r0 []*Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, identity.Requester) ([]*Dashboard, error)); ok {
|
|
return rf(ctx, user)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, identity.Requester) []*Dashboard); ok {
|
|
r0 = rf(ctx, user)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, identity.Requester) error); ok {
|
|
r1 = rf(ctx, user)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ImportDashboard provides a mock function with given fields: ctx, dto
|
|
func (_m *FakeDashboardService) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*Dashboard, error) {
|
|
ret := _m.Called(ctx, dto)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ImportDashboard")
|
|
}
|
|
|
|
var r0 *Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO) (*Dashboard, error)); ok {
|
|
return rf(ctx, dto)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO) *Dashboard); ok {
|
|
r0 = rf(ctx, dto)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO) error); ok {
|
|
r1 = rf(ctx, dto)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SaveDashboard provides a mock function with given fields: ctx, dto, allowUiUpdate
|
|
func (_m *FakeDashboardService) SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*Dashboard, error) {
|
|
ret := _m.Called(ctx, dto, allowUiUpdate)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SaveDashboard")
|
|
}
|
|
|
|
var r0 *Dashboard
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool) (*Dashboard, error)); ok {
|
|
return rf(ctx, dto, allowUiUpdate)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool) *Dashboard); ok {
|
|
r0 = rf(ctx, dto, allowUiUpdate)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*Dashboard)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO, bool) error); ok {
|
|
r1 = rf(ctx, dto, allowUiUpdate)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SearchDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) SearchDashboards(ctx context.Context, query *FindPersistedDashboardsQuery) (model.HitList, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SearchDashboards")
|
|
}
|
|
|
|
var r0 model.HitList
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *FindPersistedDashboardsQuery) (model.HitList, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *FindPersistedDashboardsQuery) model.HitList); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(model.HitList)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *FindPersistedDashboardsQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewFakeDashboardService creates a new instance of FakeDashboardService. 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 NewFakeDashboardService(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *FakeDashboardService {
|
|
mock := &FakeDashboardService{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|