Add SelfLinker

This commit is contained in:
Daniel Smith
2014-09-25 14:57:41 -07:00
parent 3e6859564a
commit 75b93cf7e9
3 changed files with 112 additions and 5 deletions

View File

@@ -40,6 +40,15 @@ type ResourceVersioner interface {
ResourceVersion(obj Object) (uint64, error)
}
// SelfLinker provides methods for setting and retrieving the SelfLink field of an API object.
type SelfLinker interface {
SetSelfLink(obj Object, selfLink string) error
SelfLink(obj Object) (string, error)
// Knowing ID is sometimes necssary to use a SelfLinker.
ID(obj Object) (string, error)
}
// All api types must support the Object interface. It's deliberately tiny so that this is not an onerous
// burden. Implement it with a pointer reciever; this will allow us to use the go compiler to check the
// one thing about our objects that it's capable of checking for us.