Documentation ¶
Index ¶
- func GetUnstructured(scheme *runtime.Scheme, obj runtime.Object) *unstructured.Unstructured
- func MarshalJSON(obj runtime.Object) (marshaled []byte)
- func NamespacedName(obj runtime.Object) types.NamespacedName
- func StripLabel(key string, objs ...runtime.Object) (stripped []runtime.Object)
- func WithItems(list runtime.Object, items ...runtime.Object) runtime.Object
- func WithLabel(key, value string, objs ...runtime.Object) (labelled []runtime.Object)
- func WithName(name string, obj runtime.Object) runtime.Object
- type FixtureFiller
- type FixtureFillerConfig
- type FixtureFillerFunc
- type FixtureFillerOption
- type PrototypeFiller
- type RuntimeMetaObject
- func WithLabels(labels map[string]string, obj RuntimeMetaObject) RuntimeMetaObject
- func WithNamespace(namespace string, obj runtime.Object) RuntimeMetaObject
- func WithNamespacedName(name *types.NamespacedName, obj runtime.Object) RuntimeMetaObject
- func WithOwner(owner, obj RuntimeMetaObject) RuntimeMetaObject
- type TypedFixtureFiller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUnstructured ¶
func GetUnstructured(scheme *runtime.Scheme, obj runtime.Object) *unstructured.Unstructured
GetUnstructured gets an Unstructured for the given object and panics if it fails.
func MarshalJSON ¶
MarshalJSON marshals an object to JSON and panics if it can't.
func NamespacedName ¶
func NamespacedName(obj runtime.Object) types.NamespacedName
NamespacedName returns the namespaced name of the given object and panics if it can't access the object's meta.
func StripLabel ¶
StripLabel removes the label with the given key from each object given and panics if it can't access an object's meta.
Types ¶
type FixtureFiller ¶
type FixtureFiller interface { // NewFixture populates a given fixture. Fill(fixture RuntimeMetaObject) RuntimeMetaObject }
FixtureFiller knows how to fill fixtures.
type FixtureFillerConfig ¶
type FixtureFillerConfig struct {
// contains filtered or unexported fields
}
FixtureFillerConfig holds the configuration needed to build a FixtureFiller.
type FixtureFillerFunc ¶
type FixtureFillerFunc func(fixture RuntimeMetaObject) RuntimeMetaObject
FixtureFillerFunc is a function that implements FixtureFiller.
func (FixtureFillerFunc) Fill ¶
func (f FixtureFillerFunc) Fill(fixture RuntimeMetaObject) RuntimeMetaObject
Fill invokes a FixtureFillerFunc on a fixture.
type FixtureFillerOption ¶
type FixtureFillerOption func(*FixtureFillerConfig)
FixtureFillerOption represents a configuration option for building a FixtureFiller.
func WithFixture ¶
func WithFixture(fixture RuntimeMetaObject) FixtureFillerOption
WithFixture configures a FixtureFiller to copy the contents of the given fixture to fixtures of the same type.
func WithFixtureFile ¶
func WithFixtureFile(fixture RuntimeMetaObject, file string) FixtureFillerOption
WithFixtureFile configures a FixtureFiller to use a file to populate fixtures of a given type.
type PrototypeFiller ¶
type PrototypeFiller struct {
// contains filtered or unexported fields
}
PrototypeFiller is a Filler that copies existing fields from a prototypical instance of a fixture.
func (*PrototypeFiller) Fill ¶
func (p *PrototypeFiller) Fill(fixture RuntimeMetaObject) RuntimeMetaObject
Fill populates a fixture by copying a prototypical fixture. Panics if a given fixture is not the same type as the prototype.
type RuntimeMetaObject ¶
RuntimeMetaObject is an object with both runtime and metadata level info.
func WithLabels ¶
func WithLabels(labels map[string]string, obj RuntimeMetaObject) RuntimeMetaObject
WithLabels sets the labels of an object and returns the updated result.
func WithNamespace ¶
func WithNamespace(namespace string, obj runtime.Object) RuntimeMetaObject
WithNamespace sets the namespace of the given object and panics if it can't access the object's meta.
func WithNamespacedName ¶
func WithNamespacedName(name *types.NamespacedName, obj runtime.Object) RuntimeMetaObject
WithNamespacedName sets the namespace and name of the given object.
func WithOwner ¶
func WithOwner(owner, obj RuntimeMetaObject) RuntimeMetaObject
WithOwner appends the an owner to an object and returns a panic if it fails.
type TypedFixtureFiller ¶
type TypedFixtureFiller struct {
// contains filtered or unexported fields
}
TypedFixtureFiller is a set of fillers keyed by fixture type.
func NewFixtureFiller ¶
func NewFixtureFiller(options ...FixtureFillerOption) *TypedFixtureFiller
NewFixtureFiller builds and returns a new FixtureFiller.
func (*TypedFixtureFiller) Fill ¶
func (t *TypedFixtureFiller) Fill(fixture RuntimeMetaObject) RuntimeMetaObject
Fill populates a fixture if an associated filler has been defined for its type. Panics if there's no filler defined for the fixture type.