Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
This commit is contained in:
2
pkg/client/cache/reflector.go
vendored
2
pkg/client/cache/reflector.go
vendored
@@ -42,7 +42,7 @@ type Reflector struct {
|
||||
// WatchFactory should begin a watch at the specified version.
|
||||
type WatchFactory func(resourceVersion uint64) (watch.Interface, error)
|
||||
|
||||
// NewReflector makes a new Reflector object which will keep the given store up to
|
||||
// NewReflector creates a new Reflector object which will keep the given store up to
|
||||
// date with the server's contents for the given resource. Reflector promises to
|
||||
// only put things in the store that have the type of expectedType.
|
||||
func NewReflector(watchFactory WatchFactory, expectedType interface{}, store Store) *Reflector {
|
||||
|
@@ -43,7 +43,7 @@ type Interface interface {
|
||||
MinionInterface
|
||||
}
|
||||
|
||||
// PodInterface has methods to work with Pod resources
|
||||
// PodInterface has methods to work with Pod resources.
|
||||
type PodInterface interface {
|
||||
ListPods(selector labels.Selector) (api.PodList, error)
|
||||
GetPod(name string) (api.Pod, error)
|
||||
@@ -52,7 +52,7 @@ type PodInterface interface {
|
||||
UpdatePod(api.Pod) (api.Pod, error)
|
||||
}
|
||||
|
||||
// ReplicationControllerInterface has methods to work with ReplicationController resources
|
||||
// ReplicationControllerInterface has methods to work with ReplicationController resources.
|
||||
type ReplicationControllerInterface interface {
|
||||
ListReplicationControllers(selector labels.Selector) (api.ReplicationControllerList, error)
|
||||
GetReplicationController(name string) (api.ReplicationController, error)
|
||||
@@ -62,7 +62,7 @@ type ReplicationControllerInterface interface {
|
||||
WatchReplicationControllers(label, field labels.Selector, resourceVersion uint64) (watch.Interface, error)
|
||||
}
|
||||
|
||||
// ServiceInterface has methods to work with Service resources
|
||||
// ServiceInterface has methods to work with Service resources.
|
||||
type ServiceInterface interface {
|
||||
GetService(name string) (api.Service, error)
|
||||
CreateService(api.Service) (api.Service, error)
|
||||
@@ -73,7 +73,7 @@ type ServiceInterface interface {
|
||||
WatchEndpoints(label, field labels.Selector, resourceVersion uint64) (watch.Interface, error)
|
||||
}
|
||||
|
||||
// VersionInterface has a method to retrieve the server version
|
||||
// VersionInterface has a method to retrieve the server version.
|
||||
type VersionInterface interface {
|
||||
ServerVersion() (*version.Info, error)
|
||||
}
|
||||
@@ -119,14 +119,14 @@ func (s *StatusErr) Error() string {
|
||||
return fmt.Sprintf("Status: %v (%#v)", s.Status.Status, s.Status)
|
||||
}
|
||||
|
||||
// AuthInfo is used to store authorization information
|
||||
// AuthInfo is used to store authorization information.
|
||||
type AuthInfo struct {
|
||||
User string
|
||||
Password string
|
||||
}
|
||||
|
||||
// RESTClient holds common code used to work with API resources that follow the
|
||||
// Kubernetes API pattern
|
||||
// Kubernetes API pattern.
|
||||
// Host is the http://... base for the URL
|
||||
type RESTClient struct {
|
||||
host string
|
||||
@@ -168,7 +168,7 @@ func NewRESTClient(host string, auth *AuthInfo, path string) (*RESTClient, error
|
||||
}, nil
|
||||
}
|
||||
|
||||
// normalizePrefix ensures the passed initial value is valid
|
||||
// normalizePrefix ensures the passed initial value is valid.
|
||||
func normalizePrefix(host, prefix string) (*url.URL, error) {
|
||||
if host == "" {
|
||||
return nil, fmt.Errorf("host must be a URL or a host:port pair")
|
||||
@@ -197,7 +197,8 @@ func (c *RESTClient) Secure() bool {
|
||||
return c.secure
|
||||
}
|
||||
|
||||
// Execute a request, adds authentication (if auth != nil), and HTTPS cert ignoring.
|
||||
// doRequest executes a request, adds authentication (if auth != nil), and HTTPS
|
||||
// cert ignoring.
|
||||
func (c *RESTClient) doRequest(request *http.Request) ([]byte, error) {
|
||||
if c.auth != nil {
|
||||
request.SetBasicAuth(c.auth.User, c.auth.Password)
|
||||
@@ -239,30 +240,30 @@ func (c *RESTClient) doRequest(request *http.Request) ([]byte, error) {
|
||||
return body, err
|
||||
}
|
||||
|
||||
// ListPods takes a selector, and returns the list of pods that match that selector
|
||||
// ListPods takes a selector, and returns the list of pods that match that selector.
|
||||
func (c *Client) ListPods(selector labels.Selector) (result api.PodList, err error) {
|
||||
err = c.Get().Path("pods").SelectorParam("labels", selector).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPod takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs
|
||||
// GetPod takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs.
|
||||
func (c *Client) GetPod(name string) (result api.Pod, err error) {
|
||||
err = c.Get().Path("pods").Path(name).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePod takes the name of the pod, and returns an error if one occurs
|
||||
// DeletePod takes the name of the pod, and returns an error if one occurs.
|
||||
func (c *Client) DeletePod(name string) error {
|
||||
return c.Delete().Path("pods").Path(name).Do().Error()
|
||||
}
|
||||
|
||||
// CreatePod takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs
|
||||
// CreatePod takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs.
|
||||
func (c *Client) CreatePod(pod api.Pod) (result api.Pod, err error) {
|
||||
err = c.Post().Path("pods").Body(pod).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePod takes the representation of a pod to update. Returns the server's representation of the pod, and an error, if it occurs
|
||||
// UpdatePod takes the representation of a pod to update. Returns the server's representation of the pod, and an error, if it occurs.
|
||||
func (c *Client) UpdatePod(pod api.Pod) (result api.Pod, err error) {
|
||||
if pod.ResourceVersion == 0 {
|
||||
err = fmt.Errorf("invalid update object, missing resource version: %v", pod)
|
||||
@@ -272,25 +273,25 @@ func (c *Client) UpdatePod(pod api.Pod) (result api.Pod, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// ListReplicationControllers takes a selector, and returns the list of replication controllers that match that selector
|
||||
// ListReplicationControllers takes a selector, and returns the list of replication controllers that match that selector.
|
||||
func (c *Client) ListReplicationControllers(selector labels.Selector) (result api.ReplicationControllerList, err error) {
|
||||
err = c.Get().Path("replicationControllers").SelectorParam("labels", selector).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// GetReplicationController returns information about a particular replication controller
|
||||
// GetReplicationController returns information about a particular replication controller.
|
||||
func (c *Client) GetReplicationController(name string) (result api.ReplicationController, err error) {
|
||||
err = c.Get().Path("replicationControllers").Path(name).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateReplicationController creates a new replication controller
|
||||
// CreateReplicationController creates a new replication controller.
|
||||
func (c *Client) CreateReplicationController(controller api.ReplicationController) (result api.ReplicationController, err error) {
|
||||
err = c.Post().Path("replicationControllers").Body(controller).Do().Into(&result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateReplicationController updates an existing replication controller
|
||||
// UpdateReplicationController updates an existing replication controller.
|
||||
func (c *Client) UpdateReplicationController(controller api.ReplicationController) (result api.ReplicationController, err error) {
|
||||
if controller.ResourceVersion == 0 {
|
||||
err = fmt.Errorf("invalid update object, missing resource version: %v", controller)
|
||||
@@ -343,7 +344,7 @@ func (c *Client) DeleteService(name string) error {
|
||||
return c.Delete().Path("services").Path(name).Do().Error()
|
||||
}
|
||||
|
||||
// WatchService returns a watch.Interface that watches the requested services.
|
||||
// WatchServices returns a watch.Interface that watches the requested services.
|
||||
func (c *Client) WatchServices(label, field labels.Selector, resourceVersion uint64) (watch.Interface, error) {
|
||||
return c.Get().
|
||||
Path("watch").
|
||||
@@ -379,7 +380,7 @@ func (c *Client) ServerVersion() (*version.Info, error) {
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// Lists all the minions in the cluster.
|
||||
// ListMinions lists all the minions in the cluster.
|
||||
func (c *Client) ListMinions() (minionList api.MinionList, err error) {
|
||||
err = c.Get().Path("minions").Do().Into(&minionList)
|
||||
return
|
||||
|
@@ -28,7 +28,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
)
|
||||
|
||||
// ErrPodInfoNotAvailable may be returned when the requested pod info is not available
|
||||
// ErrPodInfoNotAvailable may be returned when the requested pod info is not available.
|
||||
var ErrPodInfoNotAvailable = errors.New("no pod info available")
|
||||
|
||||
// PodInfoGetter is an interface for things that can get information about a pod's containers.
|
||||
@@ -39,7 +39,7 @@ type PodInfoGetter interface {
|
||||
GetPodInfo(host, podID string) (api.PodInfo, error)
|
||||
}
|
||||
|
||||
// HTTPPodInfoGetter is the default implementation of PodInfoGetter, accesses the kubelet over HTTP
|
||||
// HTTPPodInfoGetter is the default implementation of PodInfoGetter, accesses the kubelet over HTTP.
|
||||
type HTTPPodInfoGetter struct {
|
||||
Client *http.Client
|
||||
Port uint
|
||||
|
@@ -39,7 +39,7 @@ import (
|
||||
// are therefore not allowed to set manually.
|
||||
var specialParams = util.NewStringSet("sync", "timeout")
|
||||
|
||||
// Verb begins a request with a verb (GET, POST, PUT, DELETE)
|
||||
// Verb begins a request with a verb (GET, POST, PUT, DELETE).
|
||||
//
|
||||
// Example usage of Client's request building interface:
|
||||
// auth, err := LoadAuth(filename)
|
||||
@@ -114,7 +114,7 @@ func (r *Request) Path(item string) *Request {
|
||||
return r
|
||||
}
|
||||
|
||||
// Sync sets sync/async call status by setting the "sync" parameter to "true"/"false"
|
||||
// Sync sets sync/async call status by setting the "sync" parameter to "true"/"false".
|
||||
func (r *Request) Sync(sync bool) *Request {
|
||||
if r.err != nil {
|
||||
return r
|
||||
@@ -245,7 +245,8 @@ func (r *Request) finalURL() string {
|
||||
return finalURL
|
||||
}
|
||||
|
||||
// Attempts to begin watching the requested location. Returns a watch.Interface, or an error.
|
||||
// Watch attempts to begin watching the requested location.
|
||||
// Returns a watch.Interface, or an error.
|
||||
func (r *Request) Watch() (watch.Interface, error) {
|
||||
if r.err != nil {
|
||||
return nil, r.err
|
||||
@@ -319,7 +320,7 @@ func (r Result) Get() (interface{}, error) {
|
||||
return api.Decode(r.body)
|
||||
}
|
||||
|
||||
// Into stores the result into obj, if possible..
|
||||
// Into stores the result into obj, if possible.
|
||||
func (r Result) Into(obj interface{}) error {
|
||||
if r.err != nil {
|
||||
return r.err
|
||||
@@ -327,7 +328,7 @@ func (r Result) Into(obj interface{}) error {
|
||||
return api.DecodeInto(r.body, obj)
|
||||
}
|
||||
|
||||
// Returns the error executing the request, nil if no error occurred.
|
||||
// Error returns the error executing the request, nil if no error occurred.
|
||||
func (r Result) Error() error {
|
||||
return r.err
|
||||
}
|
||||
|
Reference in New Issue
Block a user