mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #17 from brendandburns/ux
Populate 'Kind' fields for all JSON requests. This will facilitate better client side UX.
This commit is contained in:
commit
0a6a9e4011
@ -130,6 +130,7 @@ type TaskTemplate struct {
|
|||||||
|
|
||||||
// ServiceList holds a list of services
|
// ServiceList holds a list of services
|
||||||
type ServiceList struct {
|
type ServiceList struct {
|
||||||
|
JSONBase
|
||||||
Items []Service `json:"items" yaml:"items"`
|
Items []Service `json:"items" yaml:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package apiserver is ...
|
// Package apiserver contains the code that provides a RESTful api service
|
||||||
package apiserver
|
package apiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -35,10 +35,11 @@ func MakeControllerRegistryStorage(registry ControllerRegistry) apiserver.RESTSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (storage *ControllerRegistryStorage) List(*url.URL) (interface{}, error) {
|
func (storage *ControllerRegistryStorage) List(*url.URL) (interface{}, error) {
|
||||||
var result ReplicationControllerList
|
result := ReplicationControllerList{JSONBase: JSONBase{Kind: "cluster#replicationControllerList"}}
|
||||||
controllers, err := storage.registry.ListControllers()
|
controllers, err := storage.registry.ListControllers()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
result = ReplicationControllerList{
|
result = ReplicationControllerList{
|
||||||
|
JSONBase: JSONBase{Kind: "cluster#replicationControllerList"},
|
||||||
Items: controllers,
|
Items: controllers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +47,9 @@ func (storage *ControllerRegistryStorage) List(*url.URL) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (storage *ControllerRegistryStorage) Get(id string) (interface{}, error) {
|
func (storage *ControllerRegistryStorage) Get(id string) (interface{}, error) {
|
||||||
return storage.registry.GetController(id)
|
controller, err := storage.registry.GetController(id)
|
||||||
|
controller.Kind = "cluster#replicationController"
|
||||||
|
return controller, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (storage *ControllerRegistryStorage) Delete(id string) error {
|
func (storage *ControllerRegistryStorage) Delete(id string) error {
|
||||||
|
@ -60,11 +60,15 @@ func GetServiceEnvironmentVariables(registry ServiceRegistry, machine string) ([
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sr *ServiceRegistryStorage) List(*url.URL) (interface{}, error) {
|
func (sr *ServiceRegistryStorage) List(*url.URL) (interface{}, error) {
|
||||||
return sr.registry.ListServices()
|
list, err := sr.registry.ListServices()
|
||||||
|
list.Kind = "cluster#serviceList"
|
||||||
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sr *ServiceRegistryStorage) Get(id string) (interface{}, error) {
|
func (sr *ServiceRegistryStorage) Get(id string) (interface{}, error) {
|
||||||
return sr.registry.GetService(id)
|
service, err := sr.registry.GetService(id)
|
||||||
|
service.Kind = "cluster#service"
|
||||||
|
return service, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sr *ServiceRegistryStorage) Delete(id string) error {
|
func (sr *ServiceRegistryStorage) Delete(id string) error {
|
||||||
|
@ -76,6 +76,7 @@ func (storage *TaskRegistryStorage) List(url *url.URL) (interface{}, error) {
|
|||||||
Items: tasks,
|
Items: tasks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result.Kind = "cluster#taskList"
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +90,7 @@ func (storage *TaskRegistryStorage) Get(id string) (interface{}, error) {
|
|||||||
return task, err
|
return task, err
|
||||||
}
|
}
|
||||||
task.CurrentState.Info = info
|
task.CurrentState.Info = info
|
||||||
|
task.Kind = "cluster#task"
|
||||||
return task, err
|
return task, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user