eab5c2b86b
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
30 lines
950 B
Go
30 lines
950 B
Go
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package testutil
|
|
|
|
import "github.com/suzerain-io/pinniped/internal/controllerlib"
|
|
|
|
type ObservableWithInformerOption struct {
|
|
informerToFilterMap map[controllerlib.InformerGetter]controllerlib.Filter
|
|
}
|
|
|
|
func NewObservableWithInformerOption() *ObservableWithInformerOption {
|
|
return &ObservableWithInformerOption{
|
|
informerToFilterMap: make(map[controllerlib.InformerGetter]controllerlib.Filter),
|
|
}
|
|
}
|
|
|
|
func (i *ObservableWithInformerOption) WithInformer(
|
|
getter controllerlib.InformerGetter,
|
|
filter controllerlib.Filter,
|
|
opt controllerlib.InformerOption,
|
|
) controllerlib.Option {
|
|
i.informerToFilterMap[getter] = filter
|
|
return controllerlib.WithInformer(getter, filter, opt)
|
|
}
|
|
|
|
func (i *ObservableWithInformerOption) GetFilterForInformer(getter controllerlib.InformerGetter) controllerlib.Filter {
|
|
return i.informerToFilterMap[getter]
|
|
}
|