componentstatuses.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Copyright 2015 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package unversioned
  14. import (
  15. "k8s.io/kubernetes/pkg/api"
  16. )
  17. type ComponentStatusesInterface interface {
  18. ComponentStatuses() ComponentStatusInterface
  19. }
  20. // ComponentStatusInterface contains methods to retrieve ComponentStatus
  21. type ComponentStatusInterface interface {
  22. List(opts api.ListOptions) (*api.ComponentStatusList, error)
  23. Get(name string) (*api.ComponentStatus, error)
  24. // TODO: It'd be nice to have watch support at some point
  25. //Watch(opts api.ListOptions) (watch.Interface, error)
  26. }
  27. // componentStatuses implements ComponentStatusesInterface
  28. type componentStatuses struct {
  29. client *Client
  30. }
  31. func newComponentStatuses(c *Client) *componentStatuses {
  32. return &componentStatuses{c}
  33. }
  34. func (c *componentStatuses) List(opts api.ListOptions) (result *api.ComponentStatusList, err error) {
  35. result = &api.ComponentStatusList{}
  36. err = c.client.Get().
  37. Resource("componentStatuses").
  38. VersionedParams(&opts, api.ParameterCodec).
  39. Do().
  40. Into(result)
  41. return result, err
  42. }
  43. func (c *componentStatuses) Get(name string) (result *api.ComponentStatus, err error) {
  44. result = &api.ComponentStatus{}
  45. err = c.client.Get().Resource("componentStatuses").Name(name).Do().Into(result)
  46. return
  47. }