github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/componentstatuses.go (about) 1 /* 2 Copyright 2015 The Kubernetes Authors All rights reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package unversioned 18 19 import ( 20 "k8s.io/kubernetes/pkg/api" 21 "k8s.io/kubernetes/pkg/fields" 22 "k8s.io/kubernetes/pkg/labels" 23 ) 24 25 type ComponentStatusesInterface interface { 26 ComponentStatuses() ComponentStatusInterface 27 } 28 29 // ComponentStatusInterface contains methods to retrieve ComponentStatus 30 type ComponentStatusInterface interface { 31 List(label labels.Selector, field fields.Selector) (*api.ComponentStatusList, error) 32 Get(name string) (*api.ComponentStatus, error) 33 34 // TODO: It'd be nice to have watch support at some point 35 //Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) 36 } 37 38 // componentStatuses implements ComponentStatusesInterface 39 type componentStatuses struct { 40 client *Client 41 } 42 43 func newComponentStatuses(c *Client) *componentStatuses { 44 return &componentStatuses{c} 45 } 46 47 func (c *componentStatuses) List(label labels.Selector, field fields.Selector) (result *api.ComponentStatusList, err error) { 48 result = &api.ComponentStatusList{} 49 err = c.client.Get(). 50 Resource("componentStatuses"). 51 LabelsSelectorParam(label). 52 FieldsSelectorParam(field). 53 Do(). 54 Into(result) 55 56 return result, err 57 } 58 59 func (c *componentStatuses) Get(name string) (result *api.ComponentStatus, err error) { 60 result = &api.ComponentStatus{} 61 err = c.client.Get().Resource("componentStatuses").Name(name).Do().Into(result) 62 return 63 }