mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-15 20:37:39 +00:00
Merge pull request #411 from nyaxt/lint_registry
Fixes go lint errors on pkg/registry/controller_registry.go
This commit is contained in:
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
)
|
||||
|
||||
// Implementation of RESTStorage for the api server.
|
||||
// ControllerRegistryStorage is an implementation of RESTStorage for the api server.
|
||||
type ControllerRegistryStorage struct {
|
||||
registry ControllerRegistry
|
||||
podRegistry PodRegistry
|
||||
@@ -34,7 +34,7 @@ type ControllerRegistryStorage struct {
|
||||
pollPeriod time.Duration
|
||||
}
|
||||
|
||||
func MakeControllerRegistryStorage(registry ControllerRegistry, podRegistry PodRegistry) apiserver.RESTStorage {
|
||||
func NewControllerRegistryStorage(registry ControllerRegistry, podRegistry PodRegistry) apiserver.RESTStorage {
|
||||
return &ControllerRegistryStorage{
|
||||
registry: registry,
|
||||
podRegistry: podRegistry,
|
||||
@@ -42,6 +42,7 @@ func MakeControllerRegistryStorage(registry ControllerRegistry, podRegistry PodR
|
||||
}
|
||||
}
|
||||
|
||||
// List obtains a list of ReplicationControllers that match selector.
|
||||
func (storage *ControllerRegistryStorage) List(selector labels.Selector) (interface{}, error) {
|
||||
result := api.ReplicationControllerList{}
|
||||
controllers, err := storage.registry.ListControllers()
|
||||
@@ -55,6 +56,7 @@ func (storage *ControllerRegistryStorage) List(selector labels.Selector) (interf
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Get obtains the ReplicationController specified by its id.
|
||||
func (storage *ControllerRegistryStorage) Get(id string) (interface{}, error) {
|
||||
controller, err := storage.registry.GetController(id)
|
||||
if err != nil {
|
||||
@@ -63,18 +65,21 @@ func (storage *ControllerRegistryStorage) Get(id string) (interface{}, error) {
|
||||
return controller, err
|
||||
}
|
||||
|
||||
// Delete asynchronously deletes the ReplicationController specified by its id.
|
||||
func (storage *ControllerRegistryStorage) Delete(id string) (<-chan interface{}, error) {
|
||||
return apiserver.MakeAsync(func() (interface{}, error) {
|
||||
return api.Status{Status: api.StatusSuccess}, storage.registry.DeleteController(id)
|
||||
}), nil
|
||||
}
|
||||
|
||||
// Extract deserializes user provided data into an api.ReplicationController.
|
||||
func (storage *ControllerRegistryStorage) Extract(body []byte) (interface{}, error) {
|
||||
result := api.ReplicationController{}
|
||||
err := api.DecodeInto(body, &result)
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Create registers a given new ReplicationController instance to storage.registry.
|
||||
func (storage *ControllerRegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
|
||||
controller, ok := obj.(api.ReplicationController)
|
||||
if !ok {
|
||||
@@ -95,6 +100,7 @@ func (storage *ControllerRegistryStorage) Create(obj interface{}) (<-chan interf
|
||||
}), nil
|
||||
}
|
||||
|
||||
// Update replaces a given ReplicationController instance with an existing instance in storage.registry.
|
||||
func (storage *ControllerRegistryStorage) Update(obj interface{}) (<-chan interface{}, error) {
|
||||
controller, ok := obj.(api.ReplicationController)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user