fake

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MockParentGVK is used as mock GVK of a parent resource.
	MockParentGVK = schema.GroupVersionKind{
		Group:   "mock.parent.crossplane.io",
		Version: "v1alpha1",
		Kind:    "MockResource",
	}
	// MockChildGVK is used as mock GVK of a child resource.
	MockChildGVK = schema.GroupVersionKind{
		Group:   "mock.child.crossplane.io",
		Version: "v1alpha1",
		Kind:    "MockChildResource",
	}
)

Functions

This section is empty.

Types

type MockResource

type MockResource struct {
	unstructured.Unstructured
}

MockResource is a helper struct to be used in tests.

func NewMockResource

func NewMockResource(o ...MockResourceOption) *MockResource

NewMockResource returns a new instance of *MockResource.

type MockResourceOption

type MockResourceOption func(*MockResource)

MockResourceOption is used to make manipulations on the *MockResource.

func FromYAML

func FromYAML(y []byte) MockResourceOption

FromYAML unmarshals given YAML into the *MockResource instance.

func WithAdditionalAnnotations added in v0.3.0

func WithAdditionalAnnotations(a map[string]string) MockResourceOption

WithAdditionalAnnotations returns a MockResourceOption that adds given map as annotations to the *MockResource instance.

func WithAdditionalLabels added in v0.3.0

func WithAdditionalLabels(a map[string]string) MockResourceOption

WithAdditionalLabels returns a MockResourceOption that adds given map as labels to the *MockResource instance.

func WithControllerRef added in v0.4.0

func WithControllerRef(o metav1.Object, gvk schema.GroupVersionKind) MockResourceOption

WithControllerRef returns a MockResourceOption that adds an OwnerReference that points to the given object to the *MockResource instance.

func WithGVK

WithGVK returns a MockResourceOption that changes GVK of the *MockResource instance.

func WithNamespaceName

func WithNamespaceName(name, ns string) MockResourceOption

WithNamespaceName returns a MockResourceOption that changes name and namespace of the *MockResource instance.

func WithUID added in v0.4.0

func WithUID(uid types.UID) MockResourceOption

WithUID returns a MockResourceOption that changes UID of the *MockResource instance.

Jump to

Keyboard shortcuts

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