Make fieldPath part of getting a reference rather than part of making an event.

This commit is contained in:
Daniel Smith
2014-11-03 16:06:36 -08:00
parent ecebe958d2
commit 25bd151d86
5 changed files with 68 additions and 26 deletions

View File

@@ -62,6 +62,16 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
}, nil
}
// GetPartialReference is exactly like GetReference, but allows you to set the FieldPath.
func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference, error) {
ref, err := GetReference(obj)
if err != nil {
return nil, err
}
ref.FieldPath = fieldPath
return ref, nil
}
// Allow clients to preemptively get a reference to an API object and pass it to places that
// intend only to get a reference to that object. This simplifies the event recording interface.
func (*ObjectReference) IsAnAPIObject() {}