mock

package
v2.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package mock is a generated GoMock package.

Index

Constants

View Source
const FirstMockID int = 65536

Variables

This section is empty.

Functions

func NewNats

func NewNats() (nats.Publisher, nats.Subscriber)

NewNats returns a mocked version of publisher, subscriber

func SetIDForFunc

func SetIDForFunc(gen *influxdb.IDGenerator, id influxdb.ID, fn func())

SetIDForFunc replaces the id generator at the end of the pointer with one which returns the provided id. It then invokes the provided function before restoring the original value at the end of the pointer.

Types

type AuthorizationService

type AuthorizationService struct {
	// Methods for a retention.AuthorizationService
	OpenFn  func() error
	CloseFn func() error

	// Methods for an platform.AuthorizationService
	FindAuthorizationByIDFn    func(context.Context, platform.ID) (*platform.Authorization, error)
	FindAuthorizationByTokenFn func(context.Context, string) (*platform.Authorization, error)
	FindAuthorizationsFn       func(context.Context, platform.AuthorizationFilter, ...platform.FindOptions) ([]*platform.Authorization, int, error)
	CreateAuthorizationFn      func(context.Context, *platform.Authorization) error
	DeleteAuthorizationFn      func(context.Context, platform.ID) error
	UpdateAuthorizationFn      func(context.Context, platform.ID, *platform.AuthorizationUpdate) (*platform.Authorization, error)
}

AuthorizationService is a mock implementation of a retention.AuthorizationService, which also makes it a suitable mock to use wherever an platform.AuthorizationService is required.

func NewAuthorizationService

func NewAuthorizationService() *AuthorizationService

NewAuthorizationService returns a mock AuthorizationService where its methods will return zero values.

func (*AuthorizationService) CreateAuthorization

func (s *AuthorizationService) CreateAuthorization(ctx context.Context, authorization *platform.Authorization) error

CreateAuthorization creates a new authorization and sets b.ID with the new identifier.

func (*AuthorizationService) DeleteAuthorization

func (s *AuthorizationService) DeleteAuthorization(ctx context.Context, id platform.ID) error

DeleteAuthorization removes a authorization by ID.

func (*AuthorizationService) FindAuthorizationByID

func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)

FindAuthorizationByID returns a single authorization by ID.

func (*AuthorizationService) FindAuthorizationByToken

func (s *AuthorizationService) FindAuthorizationByToken(ctx context.Context, t string) (*platform.Authorization, error)

func (*AuthorizationService) FindAuthorizations

FindAuthorizations returns a list of authorizations that match filter and the total count of matching authorizations.

func (*AuthorizationService) UpdateAuthorization

UpdateAuthorization updates the status and description if available.

type Authorizer

type Authorizer struct {
	Permissions []influxdb.Permission
	AllowAll    bool
	UserID      influxdb.ID
}

Authorizer is an Authorizer for testing that can allow everything or use specific permissions

func NewMockAuthorizer

func NewMockAuthorizer(allowAll bool, permissions []influxdb.Permission) *Authorizer

func (*Authorizer) GetUserID

func (a *Authorizer) GetUserID() influxdb.ID

func (*Authorizer) Identifier

func (a *Authorizer) Identifier() influxdb.ID

func (Authorizer) Kind

func (Authorizer) Kind() string

func (*Authorizer) PermissionSet

func (a *Authorizer) PermissionSet() (influxdb.PermissionSet, error)

type AuthorizerV1

type AuthorizerV1 struct {
	AuthorizeFn func(ctx context.Context, c influxdb.CredentialsV1) (*influxdb.Authorization, error)
}

func (*AuthorizerV1) Authorize

func (a *AuthorizerV1) Authorize(ctx context.Context, c influxdb.CredentialsV1) (*influxdb.Authorization, error)

type Bucket

type Bucket struct {
	GetFn           func(key []byte) ([]byte, error)
	GetBatchFn      func(keys ...[]byte) ([][]byte, error)
	CursorFn        func() (kv.Cursor, error)
	PutFn           func(key, value []byte) error
	DeleteFn        func(key []byte) error
	ForwardCursorFn func([]byte, ...kv.CursorOption) kv.ForwardCursor
}

Bucket is the abstraction used to perform get/put/delete/get-many operations in a key value store

func (*Bucket) Cursor

func (b *Bucket) Cursor(opts ...kv.CursorHint) (kv.Cursor, error)

Cursor returns a cursor at the beginning of this bucket.

func (*Bucket) Delete

func (b *Bucket) Delete(key []byte) error

Delete should error if the transaction it was called in is not writable.

func (*Bucket) ForwardCursor

func (b *Bucket) ForwardCursor(seek []byte, opts ...kv.CursorOption) (kv.ForwardCursor, error)

ForwardCursor returns a cursor from the seek points in the configured direction.

func (*Bucket) Get

func (b *Bucket) Get(key []byte) ([]byte, error)

Get returns a key within this bucket. Errors if key does not exist.

func (*Bucket) GetBatch

func (b *Bucket) GetBatch(keys ...[]byte) ([][]byte, error)

GetBatch returns a set of keys values within this bucket.

func (*Bucket) Put

func (b *Bucket) Put(key, value []byte) error

Put should error if the transaction it was called in is not writable.

type BucketLookup

type BucketLookup struct{}

BucketLookup implements the BucketLookup interface needed by flux "from" and "to".

func (BucketLookup) Lookup

func (BucketLookup) Lookup(_ context.Context, orgID platform.ID, name string) (platform.ID, bool)

func (BucketLookup) LookupName

func (BucketLookup) LookupName(_ context.Context, orgID platform.ID, id platform.ID) string

type BucketOperationLogService

type BucketOperationLogService struct {
	GetBucketOperationLogFn func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
}

BucketOperationLogService is a mock implementation of platform.BucketOperationLogService.

func NewBucketOperationLogService

func NewBucketOperationLogService() *BucketOperationLogService

NewBucketOperationLogService returns a mock of BucketOperationLogService.

func (*BucketOperationLogService) GetBucketOperationLog

GetBucketOperationLog retrieves the operation log for the bucket with the provided id.

type BucketService

type BucketService struct {
	// Methods for a retention.BucketService
	OpenFn  func() error
	CloseFn func() error

	// Methods for an platform.BucketService
	FindBucketByIDFn      func(context.Context, platform.ID) (*platform.Bucket, error)
	FindBucketByIDCalls   SafeCount
	FindBucketByNameFn    func(context.Context, platform.ID, string) (*platform.Bucket, error)
	FindBucketByNameCalls SafeCount
	FindBucketFn          func(context.Context, platform.BucketFilter) (*platform.Bucket, error)
	FindBucketCalls       SafeCount
	FindBucketsFn         func(context.Context, platform.BucketFilter, ...platform.FindOptions) ([]*platform.Bucket, int, error)
	FindBucketsCalls      SafeCount
	CreateBucketFn        func(context.Context, *platform.Bucket) error
	CreateBucketCalls     SafeCount
	UpdateBucketFn        func(context.Context, platform.ID, platform.BucketUpdate) (*platform.Bucket, error)
	UpdateBucketCalls     SafeCount
	DeleteBucketFn        func(context.Context, platform.ID) error
	DeleteBucketCalls     SafeCount
}

BucketService is a mock implementation of a retention.BucketService, which also makes it a suitable mock to use wherever an platform.BucketService is required.

func NewBucketService

func NewBucketService() *BucketService

NewBucketService returns a mock BucketService where its methods will return zero values.

func (*BucketService) Close

func (s *BucketService) Close() error

Close closes the BucketService.

func (*BucketService) CreateBucket

func (s *BucketService) CreateBucket(ctx context.Context, bucket *platform.Bucket) error

CreateBucket creates a new bucket and sets b.ID with the new identifier.

func (*BucketService) DeleteBucket

func (s *BucketService) DeleteBucket(ctx context.Context, id platform.ID) error

DeleteBucket removes a bucket by ID.

func (*BucketService) FindBucket

func (s *BucketService) FindBucket(ctx context.Context, filter platform.BucketFilter) (*platform.Bucket, error)

FindBucket returns the first bucket that matches filter.

func (*BucketService) FindBucketByID

func (s *BucketService) FindBucketByID(ctx context.Context, id platform.ID) (*platform.Bucket, error)

FindBucketByID returns a single bucket by ID.

func (*BucketService) FindBucketByName

func (s *BucketService) FindBucketByName(ctx context.Context, orgID platform.ID, name string) (*platform.Bucket, error)

FindBucketByName returns a single bucket by name.

func (*BucketService) FindBuckets

func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketFilter, opts ...platform.FindOptions) ([]*platform.Bucket, int, error)

FindBuckets returns a list of buckets that match filter and the total count of matching buckets.

func (*BucketService) Open

func (s *BucketService) Open() error

Open opens the BucketService.

func (*BucketService) UpdateBucket

func (s *BucketService) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error)

UpdateBucket updates a single bucket with changeset.

type CheckService

type CheckService struct {
	OrganizationService
	UserResourceMappingService

	// Methods for an influxdb.CheckService
	FindCheckByIDFn    func(context.Context, influxdb.ID) (influxdb.Check, error)
	FindCheckByIDCalls SafeCount
	FindCheckFn        func(context.Context, influxdb.CheckFilter) (influxdb.Check, error)
	FindCheckCalls     SafeCount
	FindChecksFn       func(context.Context, influxdb.CheckFilter, ...influxdb.FindOptions) ([]influxdb.Check, int, error)
	FindChecksCalls    SafeCount
	CreateCheckFn      func(context.Context, influxdb.CheckCreate, influxdb.ID) error
	CreateCheckCalls   SafeCount
	UpdateCheckFn      func(context.Context, influxdb.ID, influxdb.CheckCreate) (influxdb.Check, error)
	UpdateCheckCalls   SafeCount
	PatchCheckFn       func(context.Context, influxdb.ID, influxdb.CheckUpdate) (influxdb.Check, error)
	PatchCheckCalls    SafeCount
	DeleteCheckFn      func(context.Context, influxdb.ID) error
	DeleteCheckCalls   SafeCount
}

CheckService is a mock implementation of a retention.CheckService, which also makes it a suitable mock to use wherever an influxdb.CheckService is required.

func NewCheckService

func NewCheckService() *CheckService

NewCheckService returns a mock CheckService where its methods will return zero values.

func (*CheckService) CreateCheck

func (s *CheckService) CreateCheck(ctx context.Context, check influxdb.CheckCreate, userID influxdb.ID) error

CreateCheck creates a new check and sets b.ID with the new identifier.

func (*CheckService) DeleteCheck

func (s *CheckService) DeleteCheck(ctx context.Context, id influxdb.ID) error

DeleteCheck removes a check by ID.

func (*CheckService) FindCheck

func (s *CheckService) FindCheck(ctx context.Context, filter influxdb.CheckFilter) (influxdb.Check, error)

FindCheck returns the first check that matches filter.

func (*CheckService) FindCheckByID

func (s *CheckService) FindCheckByID(ctx context.Context, id influxdb.ID) (influxdb.Check, error)

FindCheckByID returns a single check by ID.

func (*CheckService) FindChecks

func (s *CheckService) FindChecks(ctx context.Context, filter influxdb.CheckFilter, opts ...influxdb.FindOptions) ([]influxdb.Check, int, error)

FindChecks returns a list of checks that match filter and the total count of matching checks.

func (*CheckService) PatchCheck

func (s *CheckService) PatchCheck(ctx context.Context, id influxdb.ID, upd influxdb.CheckUpdate) (influxdb.Check, error)

PatchCheck updates a single check with changeset.

func (*CheckService) UpdateCheck

func (s *CheckService) UpdateCheck(ctx context.Context, id influxdb.ID, chk influxdb.CheckCreate) (influxdb.Check, error)

UpdateCheck updates everything except id orgID.

type Cursor

type Cursor struct {
	SeekFn  func(prefix []byte) (k []byte, v []byte)
	FirstFn func() (k []byte, v []byte)
	LastFn  func() (k []byte, v []byte)
	NextFn  func() (k []byte, v []byte)
	PrevFn  func() (k []byte, v []byte)
}

Cursor is an abstraction for iterating/ranging through data. A concrete implementation of a cursor can be found in cursor.go.

func (*Cursor) First

func (c *Cursor) First() (k []byte, v []byte)

First moves the cursor to the first key in the bucket.

func (*Cursor) Last

func (c *Cursor) Last() (k []byte, v []byte)

Last moves the cursor to the last key in the bucket.

func (*Cursor) Next

func (c *Cursor) Next() (k []byte, v []byte)

Next moves the cursor to the next key in the bucket.

func (*Cursor) Prev

func (c *Cursor) Prev() (k []byte, v []byte)

Prev moves the cursor to the prev key in the bucket.

func (*Cursor) Seek

func (c *Cursor) Seek(prefix []byte) (k []byte, v []byte)

Seek moves the cursor forward until reaching prefix in the key name.

type DBRPMappingService

type DBRPMappingService struct {
	FindByFn   func(ctx context.Context, cluster string, db string, rp string) (*influxdb.DBRPMapping, error)
	FindFn     func(ctx context.Context, filter influxdb.DBRPMappingFilter) (*influxdb.DBRPMapping, error)
	FindManyFn func(ctx context.Context, filter influxdb.DBRPMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.DBRPMapping, int, error)
	CreateFn   func(ctx context.Context, dbrpMap *influxdb.DBRPMapping) error
	DeleteFn   func(ctx context.Context, cluster string, db string, rp string) error
}

func NewDBRPMappingService

func NewDBRPMappingService() *DBRPMappingService

func (*DBRPMappingService) Create

func (s *DBRPMappingService) Create(ctx context.Context, dbrpMap *influxdb.DBRPMapping) error

func (*DBRPMappingService) Delete

func (s *DBRPMappingService) Delete(ctx context.Context, cluster string, db string, rp string) error

func (*DBRPMappingService) Find

func (s *DBRPMappingService) Find(ctx context.Context, filter influxdb.DBRPMappingFilter) (*influxdb.DBRPMapping, error)

func (*DBRPMappingService) FindBy

func (s *DBRPMappingService) FindBy(ctx context.Context, cluster string, db string, rp string) (*influxdb.DBRPMapping, error)

func (*DBRPMappingService) FindMany

func (s *DBRPMappingService) FindMany(ctx context.Context, filter influxdb.DBRPMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.DBRPMapping, int, error)

type DBRPMappingServiceV2

type DBRPMappingServiceV2 struct {
	FindByIDFn func(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)
	FindManyFn func(ctx context.Context, dbrp influxdb.DBRPMappingFilterV2, opts ...influxdb.FindOptions) ([]*influxdb.DBRPMappingV2, int, error)
	CreateFn   func(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
	UpdateFn   func(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error
	DeleteFn   func(ctx context.Context, orgID, id influxdb.ID) error
}

func (*DBRPMappingServiceV2) Create

func (s *DBRPMappingServiceV2) Create(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error

func (*DBRPMappingServiceV2) Delete

func (s *DBRPMappingServiceV2) Delete(ctx context.Context, orgID, id influxdb.ID) error

func (*DBRPMappingServiceV2) FindByID

func (s *DBRPMappingServiceV2) FindByID(ctx context.Context, orgID, id influxdb.ID) (*influxdb.DBRPMappingV2, error)

func (*DBRPMappingServiceV2) FindMany

func (s *DBRPMappingServiceV2) FindMany(ctx context.Context, dbrp influxdb.DBRPMappingFilterV2, opts ...influxdb.FindOptions) ([]*influxdb.DBRPMappingV2, int, error)

func (*DBRPMappingServiceV2) Update

func (s *DBRPMappingServiceV2) Update(ctx context.Context, dbrp *influxdb.DBRPMappingV2) error

type DashboardOperationLogService

type DashboardOperationLogService struct {
	GetDashboardOperationLogFn func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
}

DashboardOperationLogService is a mock implementation of platform.DashboardOperationLogService.

func NewDashboardOperationLogService

func NewDashboardOperationLogService() *DashboardOperationLogService

NewDashboardOperationLogService returns a mock of DashboardOperationLogService.

func (*DashboardOperationLogService) GetDashboardOperationLog

GetDashboardOperationLog retrieves the operation log for the dashboard with the provided id.

type DashboardService

type DashboardService struct {
	CreateDashboardF       func(context.Context, *platform.Dashboard) error
	CreateDashboardCalls   SafeCount
	FindDashboardByIDF     func(context.Context, platform.ID) (*platform.Dashboard, error)
	FindDashboardByIDCalls SafeCount
	FindDashboardsF        func(context.Context, platform.DashboardFilter, platform.FindOptions) ([]*platform.Dashboard, int, error)
	FindDashboardsCalls    SafeCount
	UpdateDashboardF       func(context.Context, platform.ID, platform.DashboardUpdate) (*platform.Dashboard, error)
	UpdateDashboardCalls   SafeCount
	DeleteDashboardF       func(context.Context, platform.ID) error
	DeleteDashboardCalls   SafeCount

	AddDashboardCellF            func(ctx context.Context, id platform.ID, c *platform.Cell, opts platform.AddDashboardCellOptions) error
	AddDashboardCellCalls        SafeCount
	RemoveDashboardCellF         func(ctx context.Context, dashboardID platform.ID, cellID platform.ID) error
	RemoveDashboardCellCalls     SafeCount
	GetDashboardCellViewF        func(ctx context.Context, dashboardID platform.ID, cellID platform.ID) (*platform.View, error)
	GetDashboardCellViewCalls    SafeCount
	UpdateDashboardCellViewF     func(ctx context.Context, dashboardID platform.ID, cellID platform.ID, upd platform.ViewUpdate) (*platform.View, error)
	UpdateDashboardCellViewCalls SafeCount
	UpdateDashboardCellF         func(ctx context.Context, dashboardID platform.ID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error)
	UpdateDashboardCellCalls     SafeCount
	CopyDashboardCellF           func(ctx context.Context, dashboardID platform.ID, cellID platform.ID) (*platform.Cell, error)
	CopyDashboardCellCalls       SafeCount
	ReplaceDashboardCellsF       func(ctx context.Context, id platform.ID, cs []*platform.Cell) error
	ReplaceDashboardCellsCalls   SafeCount
}

func NewDashboardService

func NewDashboardService() *DashboardService

NewDashboardService returns a mock of DashboardService where its methods will return zero values.

func (*DashboardService) AddDashboardCell

func (*DashboardService) CopyDashboardCell

func (s *DashboardService) CopyDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID) (*platform.Cell, error)

func (*DashboardService) CreateDashboard

func (s *DashboardService) CreateDashboard(ctx context.Context, b *platform.Dashboard) error

func (*DashboardService) DeleteDashboard

func (s *DashboardService) DeleteDashboard(ctx context.Context, id platform.ID) error

func (*DashboardService) FindDashboardByID

func (s *DashboardService) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)

func (*DashboardService) FindDashboards

func (*DashboardService) GetDashboardCellView

func (s *DashboardService) GetDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID) (*platform.View, error)

func (*DashboardService) RemoveDashboardCell

func (s *DashboardService) RemoveDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID) error

func (*DashboardService) ReplaceDashboardCells

func (s *DashboardService) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error

func (*DashboardService) UpdateDashboard

func (*DashboardService) UpdateDashboardCell

func (s *DashboardService) UpdateDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error)

func (*DashboardService) UpdateDashboardCellView

func (s *DashboardService) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID, upd platform.ViewUpdate) (*platform.View, error)

type DeleteService

type DeleteService struct {
	DeleteBucketRangePredicateF func(tx context.Context, orgID, bucketID influxdb.ID, min, max int64, pred influxdb.Predicate) error
}

DeleteService is a mock delete server.

func NewDeleteService

func NewDeleteService() DeleteService

NewDeleteService returns a mock DeleteService where its methods will return zero values.

func (DeleteService) DeleteBucketRangePredicate

func (s DeleteService) DeleteBucketRangePredicate(ctx context.Context, orgID, bucketID influxdb.ID, min, max int64, pred influxdb.Predicate) error

DeleteBucketRangePredicate calls DeleteBucketRangePredicateF.

type DocumentService

type DocumentService struct {
	CreateDocumentStoreFn func(ctx context.Context, name string) (influxdb.DocumentStore, error)
	FindDocumentStoreFn   func(ctx context.Context, name string) (influxdb.DocumentStore, error)
}

DocumentService is mocked document service.

func NewDocumentService

func NewDocumentService() *DocumentService

NewDocumentService returns a mock of DocumentService where its methods will return zero values.

func (*DocumentService) CreateDocumentStore

func (s *DocumentService) CreateDocumentStore(ctx context.Context, name string) (influxdb.DocumentStore, error)

CreateDocumentStore calls the mocked CreateDocumentStoreFn.

func (*DocumentService) FindDocumentStore

func (s *DocumentService) FindDocumentStore(ctx context.Context, name string) (influxdb.DocumentStore, error)

FindDocumentStore calls the mocked FindDocumentStoreFn.

type DocumentStore

type DocumentStore struct {
	TimeGenerator    TimeGenerator
	CreateDocumentFn func(ctx context.Context, d *influxdb.Document) error
	FindDocumentFn   func(ctx context.Context, id influxdb.ID) (*influxdb.Document, error)
	FindDocumentsFn  func(ctx context.Context, oid influxdb.ID) ([]*influxdb.Document, error)
}

DocumentStore is the mocked document store.

func NewDocumentStore

func NewDocumentStore() *DocumentStore

NewDocumentStore returns a mock of DocumentStore where its methods will return zero values.

func (*DocumentStore) CreateDocument

func (s *DocumentStore) CreateDocument(ctx context.Context, d *influxdb.Document) error

CreateDocument will call the mocked CreateDocumentFn.

func (*DocumentStore) FindDocument

func (s *DocumentStore) FindDocument(ctx context.Context, id influxdb.ID) (*influxdb.Document, error)

FindDocument will call the mocked FindDocumentFn.

func (*DocumentStore) FindDocuments

func (s *DocumentStore) FindDocuments(ctx context.Context, oid influxdb.ID) ([]*influxdb.Document, error)

FindDocuments will call the mocked FindDocumentsFn.

type Flagger

type Flagger struct {
	// contains filtered or unexported fields
}

Flagger is a mock.

func NewFlagger

func NewFlagger(flags map[feature.Flag]interface{}) *Flagger

NewFlagger returns a mock Flagger.

func (Flagger) Flags

func (f Flagger) Flags(context.Context, ...feature.Flag) (map[string]interface{}, error)

Flags returns a map of flag keys to flag values according to its configured flag map. It never returns an error.

type GeneratorOptionFn

type GeneratorOptionFn func(*GeneratorResultSet)

func WithGeneratorMaxValues

func WithGeneratorMaxValues(n int) GeneratorOptionFn

WithGeneratorMaxValues limits the number of values produced by GeneratorResultSet to n.

type GeneratorResultSet

type GeneratorResultSet struct {
	// contains filtered or unexported fields
}

func NewResultSetFromSeriesGenerator

func NewResultSetFromSeriesGenerator(sg gen.SeriesGenerator, opts ...GeneratorOptionFn) *GeneratorResultSet

NewResultSetFromSeriesGenerator transforms a SeriesGenerator into a ResultSet, and therefore may be used anywhere a ResultSet is required.

func (*GeneratorResultSet) Close

func (g *GeneratorResultSet) Close()

func (*GeneratorResultSet) Cursor

func (g *GeneratorResultSet) Cursor() cursors.Cursor

func (*GeneratorResultSet) Err

func (g *GeneratorResultSet) Err() error

func (*GeneratorResultSet) Next

func (g *GeneratorResultSet) Next() bool

func (*GeneratorResultSet) Stats

func (*GeneratorResultSet) Tags

func (g *GeneratorResultSet) Tags() models.Tags

type IDGenerator

type IDGenerator struct {
	IDFn func() influxdb.ID
}

IDGenerator is mock implementation of influxdb.IDGenerator.

func NewIDGenerator

func NewIDGenerator(s string, t *testing.T) IDGenerator

NewIDGenerator is a simple way to create immutable id generator

func NewIncrementingIDGenerator

func NewIncrementingIDGenerator(start influxdb.ID) IDGenerator

NewIncrementingIDGenerator returns an ID generator which starts at the provided ID and increments on each call to ID().

func NewStaticIDGenerator

func NewStaticIDGenerator(id influxdb.ID) IDGenerator

NewStaticIDGenerator returns an IDGenerator which produces the ID provided to this function on a call to ID().

func (IDGenerator) ID

func (g IDGenerator) ID() influxdb.ID

ID generates a new influxdb.ID from a mock function.

type LabelService

type LabelService struct {
	CreateLabelFn           func(context.Context, *platform.Label) error
	CreateLabelCalls        SafeCount
	DeleteLabelFn           func(context.Context, platform.ID) error
	DeleteLabelCalls        SafeCount
	FindLabelByIDFn         func(ctx context.Context, id platform.ID) (*platform.Label, error)
	FindLabelByIDCalls      SafeCount
	FindLabelsFn            func(context.Context, platform.LabelFilter) ([]*platform.Label, error)
	FindLabelsCalls         SafeCount
	FindResourceLabelsFn    func(context.Context, platform.LabelMappingFilter) ([]*platform.Label, error)
	FindResourceLabelsCalls SafeCount
	UpdateLabelFn           func(context.Context, platform.ID, platform.LabelUpdate) (*platform.Label, error)
	UpdateLabelCalls        SafeCount
	CreateLabelMappingFn    func(context.Context, *platform.LabelMapping) error
	CreateLabelMappingCalls SafeCount
	DeleteLabelMappingFn    func(context.Context, *platform.LabelMapping) error
	DeleteLabelMappingCalls SafeCount
}

LabelService is a mock implementation of platform.LabelService

func NewLabelService

func NewLabelService() *LabelService

NewLabelService returns a mock of LabelService where its methods will return zero values.

func (*LabelService) CreateLabel

func (s *LabelService) CreateLabel(ctx context.Context, l *platform.Label) error

CreateLabel creates a new Label.

func (*LabelService) CreateLabelMapping

func (s *LabelService) CreateLabelMapping(ctx context.Context, m *platform.LabelMapping) error

CreateLabelMapping creates a new Label mapping.

func (*LabelService) DeleteLabel

func (s *LabelService) DeleteLabel(ctx context.Context, id platform.ID) error

DeleteLabel removes a Label.

func (*LabelService) DeleteLabelMapping

func (s *LabelService) DeleteLabelMapping(ctx context.Context, m *platform.LabelMapping) error

DeleteLabelMapping removes a Label mapping.

func (*LabelService) FindLabelByID

func (s *LabelService) FindLabelByID(ctx context.Context, id platform.ID) (*platform.Label, error)

FindLabelByID finds mappings by their ID

func (*LabelService) FindLabels

func (s *LabelService) FindLabels(ctx context.Context, filter platform.LabelFilter, opt ...platform.FindOptions) ([]*platform.Label, error)

FindLabels finds mappings that match a given filter.

func (*LabelService) FindResourceLabels

func (s *LabelService) FindResourceLabels(ctx context.Context, filter platform.LabelMappingFilter) ([]*platform.Label, error)

FindResourceLabels finds mappings that match a given filter.

func (*LabelService) UpdateLabel

func (s *LabelService) UpdateLabel(ctx context.Context, id platform.ID, upd platform.LabelUpdate) (*platform.Label, error)

UpdateLabel updates a label.

type LookupService

type LookupService struct {
	NameFn func(ctx context.Context, resource platform.ResourceType, id platform.ID) (string, error)
}

LookupService provides field lookup for the resource and ID.

func NewLookupService

func NewLookupService() *LookupService

NewLookupService returns a mock of LookupService where its methods will return zero values.

func (*LookupService) FindResourceName

func (s *LookupService) FindResourceName(ctx context.Context, resource platform.ResourceType, id platform.ID) (string, error)

FindResourceName returns the name for the resource and ID.

type MockIDGenerator

type MockIDGenerator struct {
	Last  *influxdb.ID
	Count int
}

func NewMockIDGenerator

func NewMockIDGenerator() *MockIDGenerator

func (*MockIDGenerator) ID

func (g *MockIDGenerator) ID() influxdb.ID

type MockPasswordsService

type MockPasswordsService struct {
	// contains filtered or unexported fields
}

MockPasswordsService is a mock of PasswordsService interface

func NewMockPasswordsService

func NewMockPasswordsService(ctrl *gomock.Controller) *MockPasswordsService

NewMockPasswordsService creates a new mock instance

func (*MockPasswordsService) CompareAndSetPassword

func (m *MockPasswordsService) CompareAndSetPassword(arg0 context.Context, arg1 influxdb.ID, arg2, arg3 string) error

CompareAndSetPassword mocks base method

func (*MockPasswordsService) ComparePassword

func (m *MockPasswordsService) ComparePassword(arg0 context.Context, arg1 influxdb.ID, arg2 string) error

ComparePassword mocks base method

func (*MockPasswordsService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPasswordsService) SetPassword

func (m *MockPasswordsService) SetPassword(arg0 context.Context, arg1 influxdb.ID, arg2 string) error

SetPassword mocks base method

type MockPasswordsServiceMockRecorder

type MockPasswordsServiceMockRecorder struct {
	// contains filtered or unexported fields
}

MockPasswordsServiceMockRecorder is the mock recorder for MockPasswordsService

func (*MockPasswordsServiceMockRecorder) CompareAndSetPassword

func (mr *MockPasswordsServiceMockRecorder) CompareAndSetPassword(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

CompareAndSetPassword indicates an expected call of CompareAndSetPassword

func (*MockPasswordsServiceMockRecorder) ComparePassword

func (mr *MockPasswordsServiceMockRecorder) ComparePassword(arg0, arg1, arg2 interface{}) *gomock.Call

ComparePassword indicates an expected call of ComparePassword

func (*MockPasswordsServiceMockRecorder) SetPassword

func (mr *MockPasswordsServiceMockRecorder) SetPassword(arg0, arg1, arg2 interface{}) *gomock.Call

SetPassword indicates an expected call of SetPassword

type NatsPublisher

type NatsPublisher struct {
	// contains filtered or unexported fields
}

NatsPublisher is a mocked nats publisher.

func (*NatsPublisher) Publish

func (p *NatsPublisher) Publish(subject string, r io.Reader) error

Publish add subject and msg to server.

type NatsServer

type NatsServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NatsServer is the mocked nats server based buffered channel.

type NatsSubscriber

type NatsSubscriber struct {
	// contains filtered or unexported fields
}

NatsSubscriber is mocked nats subscriber.

func (*NatsSubscriber) Subscribe

func (s *NatsSubscriber) Subscribe(subject, group string, handler nats.Handler) error

Subscribe implements nats.Subscriber interface.

type NotificationEndpointService

type NotificationEndpointService struct {
	*OrganizationService
	*UserResourceMappingService
	FindNotificationEndpointByIDF     func(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)
	FindNotificationEndpointByIDCalls SafeCount
	FindNotificationEndpointsF        func(ctx context.Context, filter influxdb.NotificationEndpointFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error)
	FindNotificationEndpointsCalls    SafeCount
	CreateNotificationEndpointF       func(ctx context.Context, nr influxdb.NotificationEndpoint, userID influxdb.ID) error
	CreateNotificationEndpointCalls   SafeCount
	UpdateNotificationEndpointF       func(ctx context.Context, id influxdb.ID, nr influxdb.NotificationEndpoint, userID influxdb.ID) (influxdb.NotificationEndpoint, error)
	UpdateNotificationEndpointCalls   SafeCount
	PatchNotificationEndpointF        func(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)
	PatchNotificationEndpointCalls    SafeCount
	DeleteNotificationEndpointF       func(ctx context.Context, id influxdb.ID) ([]influxdb.SecretField, influxdb.ID, error)
	DeleteNotificationEndpointCalls   SafeCount
}

NotificationEndpointService represents a service for managing notification rule data.

func NewNotificationEndpointService

func NewNotificationEndpointService() *NotificationEndpointService

func (*NotificationEndpointService) CreateNotificationEndpoint

func (s *NotificationEndpointService) CreateNotificationEndpoint(ctx context.Context, nr influxdb.NotificationEndpoint, userID influxdb.ID) error

CreateNotificationEndpoint creates a new notification rule and sets ID with the new identifier.

func (*NotificationEndpointService) DeleteNotificationEndpoint

func (s *NotificationEndpointService) DeleteNotificationEndpoint(ctx context.Context, id influxdb.ID) ([]influxdb.SecretField, influxdb.ID, error)

DeleteNotificationEndpoint removes a notification rule by ID.

func (*NotificationEndpointService) FindNotificationEndpointByID

func (s *NotificationEndpointService) FindNotificationEndpointByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)

FindNotificationEndpointByID returns a single telegraf config by ID.

func (*NotificationEndpointService) FindNotificationEndpoints

func (s *NotificationEndpointService) FindNotificationEndpoints(ctx context.Context, filter influxdb.NotificationEndpointFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationEndpoint, int, error)

FindNotificationEndpoints returns a list of notification rules that match filter and the total count of matching notification rules. Additional options provide pagination & sorting.

func (*NotificationEndpointService) PatchNotificationEndpoint

func (s *NotificationEndpointService) PatchNotificationEndpoint(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)

PatchNotificationEndpoint updates a single notification rule with changeset. Returns the new notification rule after update.

func (*NotificationEndpointService) UpdateNotificationEndpoint

func (s *NotificationEndpointService) UpdateNotificationEndpoint(ctx context.Context, id influxdb.ID, nr influxdb.NotificationEndpoint, userID influxdb.ID) (influxdb.NotificationEndpoint, error)

UpdateNotificationEndpoint updates a single notification rule. Returns the new notification rule after update.

type NotificationRuleStore

type NotificationRuleStore struct {
	*OrganizationService
	*UserResourceMappingService
	FindNotificationRuleByIDF     func(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)
	FindNotificationRuleByIDCalls SafeCount
	FindNotificationRulesF        func(ctx context.Context, filter influxdb.NotificationRuleFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationRule, int, error)
	FindNotificationRulesCalls    SafeCount
	CreateNotificationRuleF       func(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error
	CreateNotificationRuleCalls   SafeCount
	UpdateNotificationRuleF       func(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, userID influxdb.ID) (influxdb.NotificationRule, error)
	UpdateNotificationRuleCalls   SafeCount
	PatchNotificationRuleF        func(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)
	PatchNotificationRuleCalls    SafeCount
	DeleteNotificationRuleF       func(ctx context.Context, id influxdb.ID) error
	DeleteNotificationRuleCalls   SafeCount
}

NotificationRuleStore represents a service for managing notification rule data.

func NewNotificationRuleStore

func NewNotificationRuleStore() *NotificationRuleStore

NewNotificationRuleStore creats a fake notification rules tore.

func (*NotificationRuleStore) CreateNotificationRule

func (s *NotificationRuleStore) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error

CreateNotificationRule creates a new notification rule and sets ID with the new identifier.

func (*NotificationRuleStore) DeleteNotificationRule

func (s *NotificationRuleStore) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error

DeleteNotificationRule removes a notification rule by ID.

func (*NotificationRuleStore) FindNotificationRuleByID

func (s *NotificationRuleStore) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)

FindNotificationRuleByID returns a single telegraf config by ID.

func (*NotificationRuleStore) FindNotificationRules

func (s *NotificationRuleStore) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, opt ...influxdb.FindOptions) ([]influxdb.NotificationRule, int, error)

FindNotificationRules returns a list of notification rules that match filter and the total count of matching notification rules. Additional options provide pagination & sorting.

func (*NotificationRuleStore) PatchNotificationRule

func (s *NotificationRuleStore) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)

PatchNotificationRule updates a single notification rule with changeset. Returns the new notification rule after update.

func (*NotificationRuleStore) UpdateNotificationRule

func (s *NotificationRuleStore) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, userID influxdb.ID) (influxdb.NotificationRule, error)

UpdateNotificationRule updates a single notification rule. Returns the new notification rule after update.

type OnboardingService

OnboardingService is a mock implementation of platform.OnboardingService.

func NewOnboardingService

func NewOnboardingService() *OnboardingService

NewOnboardingService returns a mock of OnboardingService where its methods will return zero values.

func (*OnboardingService) IsOnboarding

func (s *OnboardingService) IsOnboarding(ctx context.Context) (bool, error)

IsOnboarding determine if onboarding request is allowed.

func (*OnboardingService) OnboardInitialUser

OnboardInitialUser OnboardingResults.

func (*OnboardingService) OnboardUser

OnboardUser OnboardingResults.

type OrganizationLookup

type OrganizationLookup struct{}

OrganizationLookup implements the OrganizationLookup interface needed by flux "from" and "to".

func (OrganizationLookup) Lookup

func (OrganizationLookup) LookupName

func (OrganizationLookup) LookupName(_ context.Context, id platform.ID) string

type OrganizationOperationLogService

type OrganizationOperationLogService struct {
	GetOrganizationOperationLogFn func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
}

OrganizationOperationLogService is a mock implementation of platform.OrganizationOperationLogService.

func NewOrganizationOperationLogService

func NewOrganizationOperationLogService() *OrganizationOperationLogService

NewOrganizationOperationLogService returns a mock of OrganizationOperationLogService.

func (*OrganizationOperationLogService) GetOrganizationOperationLog

func (s *OrganizationOperationLogService) GetOrganizationOperationLog(ctx context.Context, id platform.ID, opts platform.FindOptions) ([]*platform.OperationLogEntry, int, error)

GetOrganizationOperationLog retrieves the operation log for the org with the provided id.

type OrganizationService

type OrganizationService struct {
	FindOrganizationByIDF       func(ctx context.Context, id platform.ID) (*platform.Organization, error)
	FindOrganizationF           func(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error)
	FindOrganizationsF          func(ctx context.Context, filter platform.OrganizationFilter, opt ...platform.FindOptions) ([]*platform.Organization, int, error)
	CreateOrganizationF         func(ctx context.Context, b *platform.Organization) error
	UpdateOrganizationF         func(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error)
	DeleteOrganizationF         func(ctx context.Context, id platform.ID) error
	FindResourceOrganizationIDF func(ctx context.Context, rt platform.ResourceType, id platform.ID) (platform.ID, error)
}

OrganizationService is a mock organization server.

func NewOrganizationService

func NewOrganizationService() *OrganizationService

NewOrganizationService returns a mock OrganizationService where its methods will return zero values.

func (*OrganizationService) CreateOrganization

func (s *OrganizationService) CreateOrganization(ctx context.Context, b *platform.Organization) error

CreateOrganization calls CreateOrganizationF.

func (*OrganizationService) DeleteOrganization

func (s *OrganizationService) DeleteOrganization(ctx context.Context, id platform.ID) error

DeleteOrganization calls DeleteOrganizationF.

func (*OrganizationService) FindOrganization

FindOrganization calls FindOrganizationF.

func (*OrganizationService) FindOrganizationByID

func (s *OrganizationService) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error)

FindOrganizationByID calls FindOrganizationByIDF.

func (*OrganizationService) FindOrganizations

FindOrganizations calls FindOrganizationsF.

func (*OrganizationService) FindResourceOrganizationID

func (s *OrganizationService) FindResourceOrganizationID(ctx context.Context, rt platform.ResourceType, id platform.ID) (platform.ID, error)

FindResourceOrganizationID calls FindResourceOrganizationIDF.

func (*OrganizationService) UpdateOrganization

UpdateOrganization calls UpdateOrganizationF.

type PagingFilter

type PagingFilter struct {
	Name string
	Type []string
}

func (PagingFilter) QueryParams

func (f PagingFilter) QueryParams() map[string][]string

type PasswordsService

type PasswordsService struct {
	SetPasswordFn           func(context.Context, influxdb.ID, string) error
	ComparePasswordFn       func(context.Context, influxdb.ID, string) error
	CompareAndSetPasswordFn func(context.Context, influxdb.ID, string, string) error
}

PasswordsService is a mock implementation of a retention.PasswordsService, which also makes it a suitable mock to use wherever an platform.PasswordsService is required.

func NewPasswordsService

func NewPasswordsService() *PasswordsService

NewPasswordsService returns a mock PasswordsService where its methods will return zero values.

func (*PasswordsService) CompareAndSetPassword

func (s *PasswordsService) CompareAndSetPassword(ctx context.Context, userID influxdb.ID, old string, new string) error

CompareAndSetPassword compares the provided password and sets it to the new password.

func (*PasswordsService) ComparePassword

func (s *PasswordsService) ComparePassword(ctx context.Context, userID influxdb.ID, password string) error

ComparePassword password compares the provided password.

func (*PasswordsService) SetPassword

func (s *PasswordsService) SetPassword(ctx context.Context, userID influxdb.ID, password string) error

SetPassword sets the users current password to be the provided password.

type PointsWriter

type PointsWriter struct {
	Points []models.Point
	Err    error

	WritePointsFn func(ctx context.Context, orgID influxdb.ID, bucketID influxdb.ID, points []models.Point) error
	// contains filtered or unexported fields
}

PointsWriter is a mock structure for writing points.

func (*PointsWriter) ForceError

func (p *PointsWriter) ForceError(err error)

ForceError is for error testing, if WritePoints is called after ForceError, it will return that error.

func (*PointsWriter) Next

func (p *PointsWriter) Next() models.Point

Next returns the next (oldest) batch of values.

func (*PointsWriter) WritePoints

func (p *PointsWriter) WritePoints(ctx context.Context, orgID influxdb.ID, bucketID influxdb.ID, points []models.Point) error

WritePoints writes points to the PointsWriter that will be exposed in the Values.

func (*PointsWriter) WritePointsCalled

func (p *PointsWriter) WritePointsCalled() int

type RetentionService

type RetentionService struct {
	OpenFn                 func() error
	CloseFn                func() error
	PrometheusCollectorsFn func() []prometheus.Collector
}

func NewRetentionService

func NewRetentionService() *RetentionService

func (*RetentionService) Close

func (s *RetentionService) Close() error

func (*RetentionService) Open

func (s *RetentionService) Open() error

func (*RetentionService) PrometheusCollectors

func (s *RetentionService) PrometheusCollectors() []prometheus.Collector

type SafeCount

type SafeCount struct {
	// contains filtered or unexported fields
}

SafeCount provides a safe counter, useful for call counts to maintain thread safety. Removes burden of having to introduce serialization when concurrency is brought in.

func (*SafeCount) Count

func (s *SafeCount) Count() int

Count returns the current count.

func (*SafeCount) IncrFn

func (s *SafeCount) IncrFn() func()

IncrFn increments the safe counter by 1.

func (*SafeCount) Reset

func (s *SafeCount) Reset()

Reset will reset the count to 0.

type ScraperTargetStoreService

type ScraperTargetStoreService struct {
	UserResourceMappingService
	OrganizationService
	ListTargetsF   func(ctx context.Context, filter platform.ScraperTargetFilter) ([]platform.ScraperTarget, error)
	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
	UpdateTargetF  func(ctx context.Context, t *platform.ScraperTarget, userID platform.ID) (*platform.ScraperTarget, error)
}

ScraperTargetStoreService is a mock implementation of a platform.ScraperTargetStoreService.

func (*ScraperTargetStoreService) AddTarget

AddTarget adds a scraper target.

func (*ScraperTargetStoreService) GetTargetByID

GetTargetByID retrieves a scraper target by id.

func (*ScraperTargetStoreService) ListTargets

ListTargets lists all the scraper targets.

func (*ScraperTargetStoreService) RemoveTarget

func (s *ScraperTargetStoreService) RemoveTarget(ctx context.Context, id platform.ID) error

RemoveTarget deletes a scraper target.

func (*ScraperTargetStoreService) UpdateTarget

UpdateTarget updates a scraper target.

type SecretService

type SecretService struct {
	LoadSecretFn    func(ctx context.Context, orgID platform.ID, k string) (string, error)
	GetSecretKeysFn func(ctx context.Context, orgID platform.ID) ([]string, error)
	PutSecretFn     func(ctx context.Context, orgID platform.ID, k string, v string) error
	PutSecretsFn    func(ctx context.Context, orgID platform.ID, m map[string]string) error
	PatchSecretsFn  func(ctx context.Context, orgID platform.ID, m map[string]string) error
	DeleteSecretFn  func(ctx context.Context, orgID platform.ID, ks ...string) error
}

SecretService is a mock implementation of a retention.SecretService, which also makes it a suitable mock to use wherever an platform.SecretService is required.

func NewSecretService

func NewSecretService() *SecretService

NewSecretService returns a mock SecretService where its methods will return zero values.

func (*SecretService) DeleteSecret

func (s *SecretService) DeleteSecret(ctx context.Context, orgID platform.ID, ks ...string) error

DeleteSecret removes a single secret from the secret store.

func (*SecretService) GetSecretKeys

func (s *SecretService) GetSecretKeys(ctx context.Context, orgID platform.ID) ([]string, error)

GetSecretKeys retrieves all secret keys that are stored for the organization orgID.

func (*SecretService) LoadSecret

func (s *SecretService) LoadSecret(ctx context.Context, orgID platform.ID, k string) (string, error)

LoadSecret retrieves the secret value v found at key k for organization orgID.

func (*SecretService) PatchSecrets

func (s *SecretService) PatchSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PatchSecrets patches all provided secrets and updates any previous values.

func (*SecretService) PutSecret

func (s *SecretService) PutSecret(ctx context.Context, orgID platform.ID, k string, v string) error

PutSecret stores the secret pair (k,v) for the organization orgID.

func (*SecretService) PutSecrets

func (s *SecretService) PutSecrets(ctx context.Context, orgID platform.ID, m map[string]string) error

PutSecrets puts all provided secrets and overwrites any previous values.

type SessionService

type SessionService struct {
	FindSessionFn   func(context.Context, string) (*platform.Session, error)
	ExpireSessionFn func(context.Context, string) error
	CreateSessionFn func(context.Context, string) (*platform.Session, error)
	RenewSessionFn  func(ctx context.Context, session *platform.Session, newExpiration time.Time) error
}

SessionService is a mock implementation of a retention.SessionService, which also makes it a suitable mock to use wherever an platform.SessionService is required.

func NewSessionService

func NewSessionService() *SessionService

NewSessionService returns a mock SessionService where its methods will return zero values.

func (*SessionService) CreateSession

func (s *SessionService) CreateSession(ctx context.Context, user string) (*platform.Session, error)

CreateSession creates a session for a user with the users maximal privileges.

func (*SessionService) ExpireSession

func (s *SessionService) ExpireSession(ctx context.Context, key string) error

ExpireSession expires the session provided at key.

func (*SessionService) FindSession

func (s *SessionService) FindSession(ctx context.Context, key string) (*platform.Session, error)

FindSession returns the session found at the provided key.

func (*SessionService) RenewSession

func (s *SessionService) RenewSession(ctx context.Context, session *platform.Session, expiredAt time.Time) error

RenewSession extends the expire time to newExpiration.

type SourceService

type SourceService struct {
	DefaultSourceFn  func(context.Context) (*platform.Source, error)
	FindSourceByIDFn func(context.Context, platform.ID) (*platform.Source, error)
	FindSourcesFn    func(context.Context, platform.FindOptions) ([]*platform.Source, int, error)
	CreateSourceFn   func(context.Context, *platform.Source) error
	UpdateSourceFn   func(context.Context, platform.ID, platform.SourceUpdate) (*platform.Source, error)
	DeleteSourceFn   func(context.Context, platform.ID) error
}

SourceService is a mock implementation of platform.SourceService.

func NewSourceService

func NewSourceService() *SourceService

NewSourceService returns a mock of SourceService where its methods will return zero values.

func (*SourceService) CreateSource

func (s *SourceService) CreateSource(ctx context.Context, source *platform.Source) error

CreateSource sets the sources ID and stores it.

func (*SourceService) DefaultSource

func (s *SourceService) DefaultSource(ctx context.Context) (*platform.Source, error)

DefaultSource retrieves the default source.

func (*SourceService) DeleteSource

func (s *SourceService) DeleteSource(ctx context.Context, id platform.ID) error

DeleteSource removes the source.

func (*SourceService) FindSourceByID

func (s *SourceService) FindSourceByID(ctx context.Context, id platform.ID) (*platform.Source, error)

FindSourceByID retrieves a source by its ID.

func (*SourceService) FindSources

func (s *SourceService) FindSources(ctx context.Context, opts platform.FindOptions) ([]*platform.Source, int, error)

FindSources returns a list of all sources.

func (*SourceService) UpdateSource

func (s *SourceService) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error)

UpdateSource updates the source.

type StorageReader

type StorageReader struct {
	ReadFilterFn          func(ctx context.Context, spec query.ReadFilterSpec, alloc *memory.Allocator) (query.TableIterator, error)
	ReadGroupFn           func(ctx context.Context, spec query.ReadGroupSpec, alloc *memory.Allocator) (query.TableIterator, error)
	ReadTagKeysFn         func(ctx context.Context, spec query.ReadTagKeysSpec, alloc *memory.Allocator) (query.TableIterator, error)
	ReadTagValuesFn       func(ctx context.Context, spec query.ReadTagValuesSpec, alloc *memory.Allocator) (query.TableIterator, error)
	ReadWindowAggregateFn func(ctx context.Context, spec query.ReadWindowAggregateSpec, alloc *memory.Allocator) (query.TableIterator, error)
	CloseFn               func()
}

func (*StorageReader) Close

func (s *StorageReader) Close()

func (*StorageReader) ReadFilter

func (*StorageReader) ReadGroup

func (*StorageReader) ReadTagKeys

func (*StorageReader) ReadTagValues

func (*StorageReader) ReadWindowAggregate

func (s *StorageReader) ReadWindowAggregate(ctx context.Context, spec query.ReadWindowAggregateSpec, alloc *memory.Allocator) (query.TableIterator, error)

type Store

type Store struct {
	ViewFn    func(func(kv.Tx) error) error
	UpdateFn  func(func(kv.Tx) error) error
	BackupFn  func(ctx context.Context, w io.Writer) error
	RestoreFn func(ctx context.Context, r io.Reader) error
}

Store is a mock kv.Store

func (*Store) Backup

func (s *Store) Backup(ctx context.Context, w io.Writer) error

func (*Store) Restore

func (s *Store) Restore(ctx context.Context, r io.Reader) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, fn func(kv.Tx) error) error

Update opens up a transaction that will mutate data.

func (*Store) View

func (s *Store) View(ctx context.Context, fn func(kv.Tx) error) error

View opens up a transaction that will not write to any data. Implementing interfaces should take care to ensure that all view transactions do not mutate any data.

type TaskControlService

type TaskControlService struct {
	CreateRunFn        func(ctx context.Context, taskID influxdb.ID, scheduledFor time.Time, runAt time.Time) (*influxdb.Run, error)
	CurrentlyRunningFn func(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)
	ManualRunsFn       func(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)
	StartManualRunFn   func(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
	FinishRunFn        func(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
	UpdateRunStateFn   func(ctx context.Context, taskID, runID influxdb.ID, when time.Time, state influxdb.RunStatus) error
	AddRunLogFn        func(ctx context.Context, taskID, runID influxdb.ID, when time.Time, log string) error
}

func (*TaskControlService) AddRunLog

func (tcs *TaskControlService) AddRunLog(ctx context.Context, taskID, runID influxdb.ID, when time.Time, log string) error

func (*TaskControlService) CreateRun

func (tcs *TaskControlService) CreateRun(ctx context.Context, taskID influxdb.ID, scheduledFor time.Time, runAt time.Time) (*influxdb.Run, error)

func (*TaskControlService) CurrentlyRunning

func (tcs *TaskControlService) CurrentlyRunning(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)

func (*TaskControlService) FinishRun

func (tcs *TaskControlService) FinishRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)

func (*TaskControlService) ManualRuns

func (tcs *TaskControlService) ManualRuns(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)

func (*TaskControlService) StartManualRun

func (tcs *TaskControlService) StartManualRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)

func (*TaskControlService) UpdateRunState

func (tcs *TaskControlService) UpdateRunState(ctx context.Context, taskID, runID influxdb.ID, when time.Time, state influxdb.RunStatus) error

type TaskService

type TaskService struct {
	FindTaskByIDFn    func(context.Context, influxdb.ID) (*influxdb.Task, error)
	FindTaskByIDCalls SafeCount
	FindTasksFn       func(context.Context, influxdb.TaskFilter) ([]*influxdb.Task, int, error)
	FindTasksCalls    SafeCount
	CreateTaskFn      func(context.Context, influxdb.TaskCreate) (*influxdb.Task, error)
	CreateTaskCalls   SafeCount
	UpdateTaskFn      func(context.Context, influxdb.ID, influxdb.TaskUpdate) (*influxdb.Task, error)
	UpdateTaskCalls   SafeCount
	DeleteTaskFn      func(context.Context, influxdb.ID) error
	DeleteTaskCalls   SafeCount
	FindLogsFn        func(context.Context, influxdb.LogFilter) ([]*influxdb.Log, int, error)
	FindLogsCalls     SafeCount
	FindRunsFn        func(context.Context, influxdb.RunFilter) ([]*influxdb.Run, int, error)
	FindRunsCalls     SafeCount
	FindRunByIDFn     func(context.Context, influxdb.ID, influxdb.ID) (*influxdb.Run, error)
	FindRunByIDCalls  SafeCount
	CancelRunFn       func(context.Context, influxdb.ID, influxdb.ID) error
	CancelRunCalls    SafeCount
	RetryRunFn        func(context.Context, influxdb.ID, influxdb.ID) (*influxdb.Run, error)
	RetryRunCalls     SafeCount
	ForceRunFn        func(context.Context, influxdb.ID, int64) (*influxdb.Run, error)
	ForceRunCalls     SafeCount
}

func NewTaskService

func NewTaskService() *TaskService

func (*TaskService) CancelRun

func (s *TaskService) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error

func (*TaskService) CreateTask

func (s *TaskService) CreateTask(ctx context.Context, t influxdb.TaskCreate) (*influxdb.Task, error)

func (*TaskService) DeleteTask

func (s *TaskService) DeleteTask(ctx context.Context, id influxdb.ID) error

func (*TaskService) FindLogs

func (s *TaskService) FindLogs(ctx context.Context, filter influxdb.LogFilter) ([]*influxdb.Log, int, error)

func (*TaskService) FindRunByID

func (s *TaskService) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)

func (*TaskService) FindRuns

func (s *TaskService) FindRuns(ctx context.Context, filter influxdb.RunFilter) ([]*influxdb.Run, int, error)

func (*TaskService) FindTaskByID

func (s *TaskService) FindTaskByID(ctx context.Context, id influxdb.ID) (*influxdb.Task, error)

func (*TaskService) FindTasks

func (s *TaskService) FindTasks(ctx context.Context, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error)

func (*TaskService) ForceRun

func (s *TaskService) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)

func (*TaskService) RetryRun

func (s *TaskService) RetryRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)

func (*TaskService) UpdateTask

func (s *TaskService) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*influxdb.Task, error)

type TelegrafConfigStore

type TelegrafConfigStore struct {
	*UserResourceMappingService
	FindTelegrafConfigByIDF     func(ctx context.Context, id platform.ID) (*platform.TelegrafConfig, error)
	FindTelegrafConfigByIDCalls SafeCount
	FindTelegrafConfigsF        func(ctx context.Context, filter platform.TelegrafConfigFilter, opt ...platform.FindOptions) ([]*platform.TelegrafConfig, int, error)
	FindTelegrafConfigsCalls    SafeCount
	CreateTelegrafConfigF       func(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error
	CreateTelegrafConfigCalls   SafeCount
	UpdateTelegrafConfigF       func(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, userID platform.ID) (*platform.TelegrafConfig, error)
	UpdateTelegrafConfigCalls   SafeCount
	DeleteTelegrafConfigF       func(ctx context.Context, id platform.ID) error
	DeleteTelegrafConfigCalls   SafeCount
}

TelegrafConfigStore represents a service for managing telegraf config data.

func NewTelegrafConfigStore

func NewTelegrafConfigStore() *TelegrafConfigStore

NewTelegrafConfigStore constructs a new fake TelegrafConfigStore.

func (*TelegrafConfigStore) CreateTelegrafConfig

func (s *TelegrafConfigStore) CreateTelegrafConfig(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error

CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier.

func (*TelegrafConfigStore) DeleteTelegrafConfig

func (s *TelegrafConfigStore) DeleteTelegrafConfig(ctx context.Context, id platform.ID) error

DeleteTelegrafConfig removes a telegraf config by ID.

func (*TelegrafConfigStore) FindTelegrafConfigByID

func (s *TelegrafConfigStore) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (*platform.TelegrafConfig, error)

FindTelegrafConfigByID returns a single telegraf config by ID.

func (*TelegrafConfigStore) FindTelegrafConfigs

FindTelegrafConfigs returns a list of telegraf configs that match filter and the total count of matching telegraf configs. Additional options provide pagination & sorting.

func (*TelegrafConfigStore) UpdateTelegrafConfig

func (s *TelegrafConfigStore) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, userID platform.ID) (*platform.TelegrafConfig, error)

UpdateTelegrafConfig updates a single telegraf config. Returns the new telegraf config after update.

type TimeGenerator

type TimeGenerator struct {
	FakeValue time.Time
}

TimeGenerator stores a fake value of time.

func (TimeGenerator) Now

func (g TimeGenerator) Now() time.Time

Now will return the FakeValue stored in the struct.

type TokenGenerator

type TokenGenerator struct {
	TokenFn func() (string, error)
}

TokenGenerator is mock implementation of influxdb.TokenGenerator.

func NewTokenGenerator

func NewTokenGenerator(s string, err error) TokenGenerator

NewTokenGenerator is a simple way to create immutable token generator.

func (TokenGenerator) Token

func (g TokenGenerator) Token() (string, error)

Token generates a new influxdb.Token from a mock function.

type Tx

type Tx struct {
	BucketFn      func(b []byte) (kv.Bucket, error)
	ContextFn     func() context.Context
	WithContextFn func(ctx context.Context)
}

Tx is mock of a kv.Tx.

func (*Tx) Bucket

func (t *Tx) Bucket(b []byte) (kv.Bucket, error)

Bucket possibly creates and returns bucket, b.

func (*Tx) Context

func (t *Tx) Context() context.Context

Context returns the context associated with this Tx.

func (*Tx) WithContext

func (t *Tx) WithContext(ctx context.Context)

WithContext associates a context with this Tx.

type UserOperationLogService

type UserOperationLogService struct {
	GetUserOperationLogFn func(context.Context, platform.ID, platform.FindOptions) ([]*platform.OperationLogEntry, int, error)
}

UserOperationLogService is a mock implementation of platform.UserOperationLogService.

func NewUserOperationLogService

func NewUserOperationLogService() *UserOperationLogService

NewUserOperationLogService returns a mock of UserOperationLogService.

func (*UserOperationLogService) GetUserOperationLog

GetUserOperationLog retrieves the operation log for the user with the provided id.

type UserResourceMappingService

type UserResourceMappingService struct {
	FindMappingsFn  func(context.Context, platform.UserResourceMappingFilter) ([]*platform.UserResourceMapping, int, error)
	CreateMappingFn func(context.Context, *platform.UserResourceMapping) error
	DeleteMappingFn func(context.Context, platform.ID, platform.ID) error
}

UserResourceMappingService is a mock implementation of platform.UserResourceMappingService

func NewUserResourceMappingService

func NewUserResourceMappingService() *UserResourceMappingService

NewUserResourceMappingService returns a mock of UserResourceMappingService where its methods will return zero values.

func (*UserResourceMappingService) CreateUserResourceMapping

func (s *UserResourceMappingService) CreateUserResourceMapping(ctx context.Context, m *platform.UserResourceMapping) error

CreateUserResourceMapping creates a new UserResourceMapping.

func (*UserResourceMappingService) DeleteUserResourceMapping

func (s *UserResourceMappingService) DeleteUserResourceMapping(ctx context.Context, resourceID platform.ID, userID platform.ID) error

DeleteUserResourceMapping removes a UserResourceMapping.

func (*UserResourceMappingService) FindUserResourceMappings

FindUserResourceMappings finds mappings that match a given filter.

type UserService

type UserService struct {
	// Methods for a platform.UserService
	FindUserByIDFn          func(context.Context, platform.ID) (*platform.User, error)
	FindUsersFn             func(context.Context, platform.UserFilter, ...platform.FindOptions) ([]*platform.User, int, error)
	CreateUserFn            func(context.Context, *platform.User) error
	DeleteUserFn            func(context.Context, platform.ID) error
	FindUserFn              func(context.Context, platform.UserFilter) (*platform.User, error)
	UpdateUserFn            func(context.Context, platform.ID, platform.UserUpdate) (*platform.User, error)
	FindPermissionForUserFn func(context.Context, platform.ID) (platform.PermissionSet, error)
}

UserService is a mock implementation of a retention.UserService, which also makes it a suitable mock to use wherever an platform.UserService is required.

func NewUserService

func NewUserService() *UserService

NewUserService returns a mock of UserService where its methods will return zero values.

func (*UserService) CreateUser

func (s *UserService) CreateUser(ctx context.Context, User *platform.User) error

CreateUser creates a new User and sets b.ID with the new identifier.

func (*UserService) DeleteUser

func (s *UserService) DeleteUser(ctx context.Context, id platform.ID) error

DeleteUser removes a User by ID.

func (*UserService) FindPermissionForUser

func (s *UserService) FindPermissionForUser(ctx context.Context, uid platform.ID) (platform.PermissionSet, error)

func (*UserService) FindUser

func (s *UserService) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error)

FindUser finds the first user that matches a filter

func (*UserService) FindUserByID

func (s *UserService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error)

FindUserByID returns a single User by ID.

func (*UserService) FindUsers

func (s *UserService) FindUsers(ctx context.Context, filter platform.UserFilter, opts ...platform.FindOptions) ([]*platform.User, int, error)

FindUsers returns a list of Users that match filter and the total count of matching Users.

func (*UserService) UpdateUser

func (s *UserService) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error)

UpdateUser updates a user

type VariableService

type VariableService struct {
	CreateVariableF       func(context.Context, *influxdb.Variable) error
	CreateVariableCalls   SafeCount
	DeleteVariableF       func(context.Context, influxdb.ID) error
	DeleteVariableCalls   SafeCount
	FindVariableByIDF     func(context.Context, influxdb.ID) (*influxdb.Variable, error)
	FindVariableByIDCalls SafeCount
	FindVariablesF        func(context.Context, influxdb.VariableFilter, ...influxdb.FindOptions) ([]*influxdb.Variable, error)
	FindVariablesCalls    SafeCount
	ReplaceVariableF      func(context.Context, *influxdb.Variable) error
	ReplaceVariableCalls  SafeCount
	UpdateVariableF       func(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)
	UpdateVariableCalls   SafeCount
}

func NewVariableService

func NewVariableService() *VariableService

NewVariableService returns a mock of VariableService where its methods will return zero values.

func (*VariableService) CreateVariable

func (s *VariableService) CreateVariable(ctx context.Context, variable *influxdb.Variable) error

func (*VariableService) DeleteVariable

func (s *VariableService) DeleteVariable(ctx context.Context, id influxdb.ID) error

func (*VariableService) FindVariableByID

func (s *VariableService) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error)

func (*VariableService) FindVariables

func (s *VariableService) FindVariables(ctx context.Context, filter influxdb.VariableFilter, opts ...influxdb.FindOptions) ([]*influxdb.Variable, error)

func (*VariableService) ReplaceVariable

func (s *VariableService) ReplaceVariable(ctx context.Context, variable *influxdb.Variable) error

func (*VariableService) UpdateVariable

func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)

type WriteService

type WriteService struct {
	WriteF   func(context.Context, platform.ID, platform.ID, io.Reader) error
	WriteToF func(context.Context, platform.BucketFilter, io.Reader) error
}

WriteService writes data read from the reader.

func (*WriteService) Write

func (s *WriteService) Write(ctx context.Context, org, bucket platform.ID, r io.Reader) error

Write calls the mocked WriteF function with arguments.

func (*WriteService) WriteTo

func (s *WriteService) WriteTo(ctx context.Context, filter platform.BucketFilter, r io.Reader) error

Write calls the mocked WriteF function with arguments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL