Use meta.Interface and meta.Accessor

This commit is contained in:
Clayton Coleman
2014-10-23 18:01:25 -04:00
parent e5c924585c
commit 3df1c2f29d
7 changed files with 68 additions and 68 deletions

View File

@@ -36,7 +36,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
if obj == nil {
return nil, ErrNilObject
}
accessor, err := meta.FindAccessor(obj)
meta, err := meta.Accessor(obj)
if err != nil {
return nil, err
}
@@ -44,16 +44,16 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
if err != nil {
return nil, err
}
version := versionFromSelfLink.FindStringSubmatch(accessor.SelfLink())
version := versionFromSelfLink.FindStringSubmatch(meta.SelfLink())
if len(version) < 2 {
return nil, fmt.Errorf("unexpected self link format: %v", accessor.SelfLink())
return nil, fmt.Errorf("unexpected self link format: %v", meta.SelfLink())
}
return &ObjectReference{
Kind: kind,
APIVersion: version[1],
// TODO: correct Name and UID when TypeMeta makes a distinction
Name: accessor.Name(),
UID: accessor.UID(),
ResourceVersion: accessor.ResourceVersion(),
Name: meta.Name(),
UID: meta.UID(),
ResourceVersion: meta.ResourceVersion(),
}, nil
}