apps.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/apis/apps"
  16. "k8s.io/kubernetes/pkg/client/restclient"
  17. )
  18. type AppsInterface interface {
  19. PetSetNamespacer
  20. }
  21. // AppsClient is used to interact with Kubernetes batch features.
  22. type AppsClient struct {
  23. *restclient.RESTClient
  24. }
  25. func (c *AppsClient) PetSets(namespace string) PetSetInterface {
  26. return newPetSet(c, namespace)
  27. }
  28. func NewApps(c *restclient.Config) (*AppsClient, error) {
  29. config := *c
  30. if err := setGroupDefaults(apps.GroupName, &config); err != nil {
  31. return nil, err
  32. }
  33. client, err := restclient.RESTClientFor(&config)
  34. if err != nil {
  35. return nil, err
  36. }
  37. return &AppsClient{client}, nil
  38. }
  39. func NewAppsOrDie(c *restclient.Config) *AppsClient {
  40. client, err := NewApps(c)
  41. if err != nil {
  42. panic(err)
  43. }
  44. return client
  45. }