Documentation
¶
Index ¶
- Variables
- type MockResource
- type MockResourceOption
- func FromYAML(y []byte) MockResourceOption
- func WithAdditionalAnnotations(a map[string]string) MockResourceOption
- func WithAdditionalLabels(a map[string]string) MockResourceOption
- func WithControllerRef(o metav1.Object, gvk schema.GroupVersionKind) MockResourceOption
- func WithGVK(gvk schema.GroupVersionKind) MockResourceOption
- func WithNamespaceName(name, ns string) MockResourceOption
- func WithUID(uid types.UID) MockResourceOption
Constants ¶
This section is empty.
Variables ¶
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 ¶
func WithGVK(gvk schema.GroupVersionKind) MockResourceOption
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.