GoogleCloudPlatform/kubernetes — pull request #3133 by smarterclayton (2014-12-23 21:20:26+00:00)
Title: Introduce Resource/ResourceName/Prefix/Suffix options to RESTClient

RESTClient is an abstraction for simplifying access to resources that
follow the Kubernetes API pattern. Currently, both Namespace and Path
are coupled, which means changes across versions is complex. In general,
most access to resources should be to a resource collection (e.g.
"services") with a name (e.g. "foo"). Other constructs, like prefix sections
("watch") or proposed suffix sections ("/pods/foo/spec") only modify this
core pattern.

This commit removes the Path() helper from Request and introduces:

* Prefix(segments ...string) - segments that should go to the beginning of the path.
* Suffix(segments ...string) - segments that should go to the end of the path.
* Resource(string) - collection name, should be after prefix
* Namespace(string) - if specified, should be set after resource but before name
* ResourceName(string) - if specified, should be after namespace

Now, only Prefix and Suffix are order dependent (and with variadics, should be
simpler). Resource, Namespace, and ResourceName may be specified in any order.

Path() has been removed to prevent downstream consumers of RESTClient from experiencing
behavior change.