2019-01-02 07:16:27 +00:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-03-30 18:10:02 +00:00
|
|
|
platform2 "github.com/influxdata/influxdb/v2/kit/platform"
|
|
|
|
|
2020-04-03 17:39:20 +00:00
|
|
|
platform "github.com/influxdata/influxdb/v2"
|
2019-01-02 07:16:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ platform.BucketOperationLogService = (*BucketOperationLogService)(nil)
|
|
|
|
var _ platform.DashboardOperationLogService = (*DashboardOperationLogService)(nil)
|
|
|
|
var _ platform.OrganizationOperationLogService = (*OrganizationOperationLogService)(nil)
|
|
|
|
var _ platform.UserOperationLogService = (*UserOperationLogService)(nil)
|
|
|
|
|
|
|
|
// NewBucketOperationLogService returns a mock of BucketOperationLogService.
|
|
|
|
func NewBucketOperationLogService() *BucketOperationLogService {
|
|
|
|
return &BucketOperationLogService{
|
2021-03-30 18:10:02 +00:00
|
|
|
GetBucketOperationLogFn: func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return nil, 0, nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewDashboardOperationLogService returns a mock of DashboardOperationLogService.
|
|
|
|
func NewDashboardOperationLogService() *DashboardOperationLogService {
|
|
|
|
return &DashboardOperationLogService{
|
2021-03-30 18:10:02 +00:00
|
|
|
GetDashboardOperationLogFn: func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return nil, 0, nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewOrganizationOperationLogService returns a mock of OrganizationOperationLogService.
|
|
|
|
func NewOrganizationOperationLogService() *OrganizationOperationLogService {
|
|
|
|
return &OrganizationOperationLogService{
|
2021-03-30 18:10:02 +00:00
|
|
|
GetOrganizationOperationLogFn: func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return nil, 0, nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewUserOperationLogService returns a mock of UserOperationLogService.
|
|
|
|
func NewUserOperationLogService() *UserOperationLogService {
|
|
|
|
return &UserOperationLogService{
|
2021-03-30 18:10:02 +00:00
|
|
|
GetUserOperationLogFn: func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return nil, 0, nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// BucketOperationLogService is a mock implementation of platform.BucketOperationLogService.
|
|
|
|
type BucketOperationLogService struct {
|
2021-03-30 18:10:02 +00:00
|
|
|
GetBucketOperationLogFn func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
|
2019-01-02 07:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DashboardOperationLogService is a mock implementation of platform.DashboardOperationLogService.
|
|
|
|
type DashboardOperationLogService struct {
|
2021-03-30 18:10:02 +00:00
|
|
|
GetDashboardOperationLogFn func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
|
2019-01-02 07:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// OrganizationOperationLogService is a mock implementation of platform.OrganizationOperationLogService.
|
|
|
|
type OrganizationOperationLogService struct {
|
2021-03-30 18:10:02 +00:00
|
|
|
GetOrganizationOperationLogFn func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
|
2019-01-02 07:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// UserOperationLogService is a mock implementation of platform.UserOperationLogService.
|
|
|
|
type UserOperationLogService struct {
|
2021-03-30 18:10:02 +00:00
|
|
|
GetUserOperationLogFn func(context.Context, platform2.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
|
2019-01-02 07:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetBucketOperationLog retrieves the operation log for the bucket with the provided id.
|
2021-03-30 18:10:02 +00:00
|
|
|
func (s *BucketOperationLogService) GetBucketOperationLog(ctx context.Context, id platform2.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return s.GetBucketOperationLogFn(ctx, id, opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDashboardOperationLog retrieves the operation log for the dashboard with the provided id.
|
2021-03-30 18:10:02 +00:00
|
|
|
func (s *DashboardOperationLogService) GetDashboardOperationLog(ctx context.Context, id platform2.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return s.GetDashboardOperationLogFn(ctx, id, opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetOrganizationOperationLog retrieves the operation log for the org with the provided id.
|
2021-03-30 18:10:02 +00:00
|
|
|
func (s *OrganizationOperationLogService) GetOrganizationOperationLog(ctx context.Context, id platform2.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return s.GetOrganizationOperationLogFn(ctx, id, opts)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetUserOperationLog retrieves the operation log for the user with the provided id.
|
2021-03-30 18:10:02 +00:00
|
|
|
func (s *UserOperationLogService) GetUserOperationLog(ctx context.Context, id platform2.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error) {
|
2019-01-02 07:16:27 +00:00
|
|
|
return s.GetUserOperationLogFn(ctx, id, opts)
|
|
|
|
}
|