doc.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Copyright 2014 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. /*
  14. Package unversioned contains the implementation of the client side communication with the
  15. Kubernetes master. The Client class provides methods for reading, creating, updating,
  16. and deleting pods, replication controllers, daemons, services, and nodes.
  17. Most consumers should use the Config object to create a Client:
  18. import (
  19. client "k8s.io/kubernetes/pkg/client/unversioned"
  20. "k8s.io/kubernetes/pkg/api"
  21. )
  22. [...]
  23. config := &client.Config{
  24. Host: "http://localhost:8080",
  25. Username: "test",
  26. Password: "password",
  27. }
  28. client, err := client.New(config)
  29. if err != nil {
  30. // handle error
  31. }
  32. pods, err := client.Pods(api.NamespaceDefault).List(api.ListOptions{})
  33. if err != nil {
  34. // handle error
  35. }
  36. More advanced consumers may wish to provide their own transport via a http.RoundTripper:
  37. config := &client.Config{
  38. Host: "https://localhost:8080",
  39. Transport: oauthclient.Transport(),
  40. }
  41. client, err := client.New(config)
  42. The RESTClient type implements the Kubernetes API conventions (see `docs/devel/api-conventions.md`)
  43. for a given API path and is intended for use by consumers implementing their own Kubernetes
  44. compatible APIs.
  45. */
  46. package unversioned // import "k8s.io/kubernetes/pkg/client/unversioned"