influxdb/mock/scraper_service.go

46 lines
1.8 KiB
Go
Raw Normal View History

package mock
import (
"context"
platform "github.com/influxdata/influxdb"
)
var _ platform.ScraperTargetStoreService = &ScraperTargetStoreService{}
// ScraperTargetStoreService is a mock implementation of a platform.ScraperTargetStoreService.
type ScraperTargetStoreService struct {
2019-01-18 20:46:37 +00:00
UserResourceMappingService
2019-04-12 16:45:48 +00:00
OrganizationService
ListTargetsF func(ctx context.Context, filter platform.ScraperTargetFilter) ([]platform.ScraperTarget, error)
2019-01-18 20:46:37 +00:00
AddTargetF func(ctx context.Context, t *platform.ScraperTarget, userID platform.ID) error
GetTargetByIDF func(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error)
RemoveTargetF func(ctx context.Context, id platform.ID) error
2019-01-18 20:46:37 +00:00
UpdateTargetF func(ctx context.Context, t *platform.ScraperTarget, userID platform.ID) (*platform.ScraperTarget, error)
}
// ListTargets lists all the scraper targets.
2019-04-12 16:45:48 +00:00
func (s *ScraperTargetStoreService) ListTargets(ctx context.Context, filter platform.ScraperTargetFilter) ([]platform.ScraperTarget, error) {
return s.ListTargetsF(ctx, filter)
}
// AddTarget adds a scraper target.
2019-01-18 20:46:37 +00:00
func (s *ScraperTargetStoreService) AddTarget(ctx context.Context, t *platform.ScraperTarget, userID platform.ID) error {
return s.AddTargetF(ctx, t, userID)
}
// GetTargetByID retrieves a scraper target by id.
func (s *ScraperTargetStoreService) GetTargetByID(ctx context.Context, id platform.ID) (*platform.ScraperTarget, error) {
return s.GetTargetByIDF(ctx, id)
}
// RemoveTarget deletes a scraper target.
func (s *ScraperTargetStoreService) RemoveTarget(ctx context.Context, id platform.ID) error {
return s.RemoveTargetF(ctx, id)
}
// UpdateTarget updates a scraper target.
2019-01-18 20:46:37 +00:00
func (s *ScraperTargetStoreService) UpdateTarget(ctx context.Context, t *platform.ScraperTarget, userID platform.ID) (*platform.ScraperTarget, error) {
return s.UpdateTargetF(ctx, t, userID)
}