{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package client\n\nPackage client contains the implementation of the client side communication with the Kubernetes master. The Client class provides methods for reading, creating, updating, and deleting pods, replication controllers, services, and minions.\n\nMost consumers should use the Config object to create a Client:\n\n\tconfig := \u0026client.Config{\n\t  Host:     \"http://localhost:8080\",\n\t  Username: \"test\",\n\t  Password: \"password\",\n\t}\n\tclient, err := client.New(\u0026config)\n\tif err != nil {\n\t  // handle error\n\t}\n\tclient.Pods(ns).List()\n\nMore advanced consumers may wish to provide their own transport via a http.RoundTripper:\n\n\tconfig := \u0026client.Config{\n\t  Host:      \"https://localhost:8080\",\n\t  Transport: oauthclient.Transport(),\n\t}\n\tclient, err := client.New(\u0026config)\n\nThe RESTClient type implements the Kubernetes API conventions (see \\`docs/api-conventions.md\\`) for a given API path and is intended for use by consumers implementing their own Kubernetes compatible APIs.\n\n## Constants\n\n```go\nconst (\n\tJustURL         string = \"url\"\n\tURLTiming       string = \"urltiming\"\n\tCurlCommand     string = \"curlcommand\"\n\tRequestHeaders  string = \"requestheaders\"\n\tResponseStatus  string = \"responsestatus\"\n\tResponseHeaders string = \"responseheaders\"\n)\n```\n\n```go\nconst (\n\t// A constant that clients can use to refer in a field selector to the object name field.\n\t// Will be automatically emitted as the correct name for the API version.\n\tNodeUnschedulable = \"spec.unschedulable\"\n\tObjectNameField   = \"metadata.name\"\n\tPodHost           = \"spec.nodeName\"\n\tSecretType        = \"type\"\n\n\tEventReason                  = \"reason\"\n\tEventSource                  = \"source\"\n\tEventInvolvedKind            = \"involvedObject.kind\"\n\tEventInvolvedNamespace       = \"involvedObject.namespace\"\n\tEventInvolvedName            = \"involvedObject.name\"\n\tEventInvolvedUID             = \"involvedObject.uid\"\n\tEventInvolvedAPIVersion      = \"involvedObject.apiVersion\"\n\tEventInvolvedResourceVersion = \"involvedObject.resourceVersion\"\n\tEventInvolvedFieldPath       = \"involvedObject.fieldPath\"\n)\n```\n\n## Functions\n\n```go\nfunc BindClientConfigFlags(flags FlagSet, config *Config)\n```\nBindClientConfigFlags registers a standard set of CLI flags for connecting to a Kubernetes API server. TODO this method is superceded by pkg/client/clientcmd/client\\_builder.go\n\n```go\nfunc BindKubeletClientConfigFlags(flags FlagSet, config *KubeletConfig)\n```\n\n```go\nfunc ControllerHasDesiredReplicas(c Interface, controller *api.ReplicationController) wait.ConditionFunc\n```\nControllerHasDesiredReplicas returns a condition that will be true iff the desired replica count for a controller's ReplicaSelector equals the Replicas count.\n\n```go\nfunc DefaultKubernetesUserAgent() string\n```\nDefaultKubernetesUserAgent returns the default user agent that clients can use.\n\n```go\nfunc DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, error)\n```\nDefaultServerURL converts a host, host:port, or URL string to the default base server API path to use with a Client at a given API version following the standard conventions for a Kubernetes API.\n\n```go\nfunc HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error)\n```\nHTTPWrappersForConfig wraps a round tripper with any relevant layered behavior from the config. Exposed to allow more clients that need HTTP-like behavior but then must hijack the underlying connection (like WebSocket or HTTP2 clients). Pure HTTP clients should use the higher level TransportFor or RESTClientFor methods.\n\n```go\nfunc IsConfigTransportTLS(config Config) bool\n```\nIsConfigTransportTLS returns true iff the provided config will result in a protected connection to the server when it is passed to client.New() or client.RESTClientFor(). Use to determine when to send credentials over the wire.\n\nNote: the Insecure flag is ignored when testing for this value, so MITM attacks are still possible.\n\n```go\nfunc IsTimeout(err error) bool\n```\nIsTimeout tests if this is a timeout error in the underlying transport. This is unbelievably ugly. See: [http://stackoverflow.com/questions/23494950/specifically-check-for-timeout-error](http://stackoverflow.com/questions/23494950/specifically-check-for-timeout-error) for details\n\n```go\nfunc LoadTLSFiles(config *Config) error\n```\nLoadTLSFiles copies the data from the CertFile, KeyFile, and CAFile fields into the CertData, KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are either populated or were empty to start.\n\n```go\nfunc MakeTransport(config *KubeletConfig) (http.RoundTripper, error)\n```\n\n```go\nfunc MatchesServerVersion(c *Config) error\n```\nMatchesServerVersion queries the server to compares the build version (git hash) of the client with the server's build version. It returns an error if it failed to contact the server or if the versions are not an exact match.\n\n```go\nfunc NegotiateVersion(c *Config, version string) (string, error)\n```\nNegotiateVersion queries the server's supported api versions to find a version that both client and server support.\n\n  - If no version is provided, try the client's registered versions in order of preference.\n  - If version is provided, but not default config (explicitly requested via commandline flag), and is unsupported by the server, print a warning to stderr and try client's registered versions in order of preference.\n  - If version is config default, and the server does not support it, return an error.\n\n```go\nfunc NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper\n```\n\n```go\nfunc NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper\n```\n\n```go\nfunc NewClientCertTLSConfig(certData, keyData, caData []byte) (*tls.Config, error)\n```\n\n```go\nfunc NewTLSConfig(caData []byte) (*tls.Config, error)\n```\n\n```go\nfunc NewUnsafeTLSConfig() *tls.Config\n```\n\n```go\nfunc NewUserAgentRoundTripper(agent string, rt http.RoundTripper) http.RoundTripper\n```\n\n```go\nfunc SetKubernetesDefaults(config *Config) error\n```\nSetKubernetesDefaults sets default values on the provided client config for accessing the Kubernetes API or returns an error if any of the defaults are impossible or invalid.\n\n```go\nfunc TLSConfigFor(config *Config) (*tls.Config, error)\n```\nTLSConfigFor returns a tls.Config that will provide the transport level security defined by the provided Config. Will return nil if no transport level security is requested.\n\n```go\nfunc TransportFor(config *Config) (http.RoundTripper, error)\n```\nTransportFor returns an http.RoundTripper that will provide the authentication or transport level security defined by the provided Config. Will return the default http.DefaultTransport if no special case behavior is needed.\n\n## Types\n\n```go\ntype APIStatus interface {\n\tStatus() api.Status\n}\n```\nAPIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.\n\n```go\ntype Client struct {\n\t*RESTClient\n}\n```\nClient is the implementation of a Kubernetes client.\n\n```go\nfunc New(c *Config) (*Client, error)\n```\nNew creates a Kubernetes client for the given config. This client works with pods, replication controllers and services. It allows operations such as list, get, update and delete on these objects. An error is returned if the provided configuration is not valid.\n\n```go\nfunc NewInCluster() (*Client, error)\n```\nNewInCluster is a shortcut for calling InClusterConfig() and then New().\n\n```go\nfunc NewOrDie(c *Config) *Client\n```\nNewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.\n\n```go\nfunc (c *Client) ComponentStatuses() ComponentStatusInterface\n```\n\n```go\nfunc (c *Client) Endpoints(namespace string) EndpointsInterface\n```\n\n```go\nfunc (c *Client) Events(namespace string) EventInterface\n```\n\n```go\nfunc (c *Client) LimitRanges(namespace string) LimitRangeInterface\n```\n\n```go\nfunc (c *Client) Namespaces() NamespaceInterface\n```\n\n```go\nfunc (c *Client) Nodes() NodeInterface\n```\n\n```go\nfunc (c *Client) PersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface\n```\n\n```go\nfunc (c *Client) PersistentVolumes() PersistentVolumeInterface\n```\n\n```go\nfunc (c *Client) PodTemplates(namespace string) PodTemplateInterface\n```\n\n```go\nfunc (c *Client) Pods(namespace string) PodInterface\n```\n\n```go\nfunc (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface\n```\n\n```go\nfunc (c *Client) ResourceQuotas(namespace string) ResourceQuotaInterface\n```\n\n```go\nfunc (c *Client) Secrets(namespace string) SecretsInterface\n```\n\n```go\nfunc (c *Client) ServerAPIVersions() (*api.APIVersions, error)\n```\nServerAPIVersions retrieves and parses the list of API versions the server supports.\n\n```go\nfunc (c *Client) ServerVersion() (*version.Info, error)\n```\nServerVersion retrieves and parses the server's version.\n\n```go\nfunc (c *Client) ServiceAccounts(namespace string) ServiceAccountsInterface\n```\n\n```go\nfunc (c *Client) Services(namespace string) ServiceInterface\n```\n\n```go\nfunc (c *Client) ValidateComponents() (*api.ComponentStatusList, error)\n```\nValidateComponents retrieves and parses the master's self-monitored cluster state. TODO: This should hit the versioned endpoint when that is implemented.\n\n```go\ntype ComponentStatusInterface interface {\n\tList(label labels.Selector, field fields.Selector) (*api.ComponentStatusList, error)\n\tGet(name string) (*api.ComponentStatus, error)\n}\n```\nComponentStatusInterface contains methods to retrieve ComponentStatus\n\n```go\ntype ComponentStatusesInterface interface {\n\tComponentStatuses() ComponentStatusInterface\n}\n```\n\n```go\ntype ComponentValidatorInterface interface {\n\tValidateComponents() (*api.ComponentStatusList, error)\n}\n```\n\n```go\ntype Config struct {\n\t// Host must be a host string, a host:port pair, or a URL to the base of the API.\n\tHost string\n\t// Prefix is the sub path of the server. If not specified, the client will set\n\t// a default value.  Use \"/\" to indicate the server root should be used\n\tPrefix string\n\t// Version is the API version to talk to. Must be provided when initializing\n\t// a RESTClient directly. When initializing a Client, will be set with the default\n\t// code version.\n\tVersion string\n\t// Codec specifies the encoding and decoding behavior for runtime.Objects passed\n\t// to a RESTClient or Client. Required when initializing a RESTClient, optional\n\t// when initializing a Client.\n\tCodec runtime.Codec\n\n\t// Server requires Basic authentication\n\tUsername string\n\tPassword string\n\n\t// Server requires Bearer authentication. This client will not attempt to use\n\t// refresh tokens for an OAuth2 flow.\n\t// TODO: demonstrate an OAuth2 compatible client.\n\tBearerToken string\n\n\t// TLSClientConfig contains settings to enable transport layer security\n\tTLSClientConfig\n\n\t// Server should be accessed without verifying the TLS\n\t// certificate. For testing only.\n\tInsecure bool\n\n\t// UserAgent is an optional field that specifies the caller of this request.\n\tUserAgent string\n\n\t// Transport may be used for custom HTTP behavior. This attribute may not\n\t// be specified with the TLS client certificate options. Use WrapTransport\n\t// for most client level operations.\n\tTransport http.RoundTripper\n\t// WrapTransport will be invoked for custom HTTP behavior after the underlying\n\t// transport is initialized (either the transport created from TLSClientConfig,\n\t// Transport, or http.DefaultTransport). The config may layer other RoundTrippers\n\t// on top of the returned RoundTripper.\n\tWrapTransport func(rt http.RoundTripper) http.RoundTripper\n\n\t// QPS indicates the maximum QPS to the master from this client.  If zero, QPS is unlimited.\n\tQPS float32\n\n\t// Maximum burst for throttle\n\tBurst int\n}\n```\nConfig holds the common attributes that can be passed to a Kubernetes client on initialization.\n\n```go\nfunc InClusterConfig() (*Config, error)\n```\nInClusterConfig returns a config object which uses the service account kubernetes gives to pods. It's intended for clients that expect to be running inside a pod running on kuberenetes. It will return an error if called from a process not running in a kubernetes environment.\n\n```go\ntype ConnectionInfoGetter interface {\n\tGetConnectionInfo(host string) (scheme string, port uint, transport http.RoundTripper, err error)\n}\n```\n\n```go\ntype ContainerInfoGetter interface {\n\t// GetContainerInfo returns information about a container.\n\tGetContainerInfo(host, podID, containerID string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)\n\t// GetRootInfo returns information about the root container on a machine.\n\tGetRootInfo(host string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)\n\t// GetMachineInfo returns the machine's information like number of cores, memory capacity.\n\tGetMachineInfo(host string) (*cadvisorApi.MachineInfo, error)\n}\n```\n\n```go\ntype DebuggingRoundTripper struct {\n\tLevels util.StringSet\n\t// contains filtered or unexported fields\n}\n```\nDebuggingRoundTripper will display information about the requests passing through it based on what is configured\n\n```go\nfunc NewDebuggingRoundTripper(rt http.RoundTripper, levels ...string) *DebuggingRoundTripper\n```\n\n```go\nfunc (rt *DebuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)\n```\n\n```go\ntype EndpointsInterface interface {\n\tCreate(endpoints *api.Endpoints) (*api.Endpoints, error)\n\tList(selector labels.Selector) (*api.EndpointsList, error)\n\tGet(name string) (*api.Endpoints, error)\n\tDelete(name string) error\n\tUpdate(endpoints *api.Endpoints) (*api.Endpoints, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nEndpointsInterface has methods to work with Endpoints resources\n\n```go\ntype EndpointsNamespacer interface {\n\tEndpoints(namespace string) EndpointsInterface\n}\n```\nEndpointsNamespacer has methods to work with Endpoints resources in a namespace\n\n```go\ntype EventInterface interface {\n\tCreate(event *api.Event) (*api.Event, error)\n\tUpdate(event *api.Event) (*api.Event, error)\n\tList(label labels.Selector, field fields.Selector) (*api.EventList, error)\n\tGet(name string) (*api.Event, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n\t// Search finds events about the specified object\n\tSearch(objOrRef runtime.Object) (*api.EventList, error)\n\tDelete(name string) error\n\t// Returns the appropriate field selector based on the API version being used to communicate with the server.\n\t// The returned field selector can be used with List and Watch to filter desired events.\n\tGetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector\n}\n```\nEventInterface has methods to work with Event resources\n\n```go\ntype EventNamespacer interface {\n\tEvents(namespace string) EventInterface\n}\n```\nEventNamespacer can return an EventInterface for the given namespace.\n\n```go\ntype FakeKubeletClient struct{}\n```\nFakeKubeletClient is a fake implementation of KubeletClient which returns an error when called.  It is useful to pass to the master in a test configuration with no kubelets.\n\n```go\nfunc (c FakeKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error)\n```\n\n```go\nfunc (c FakeKubeletClient) HealthCheck(host string) (probe.Result, string, error)\n```\n\n```go\ntype FakeRESTClient struct {\n\tClient HTTPClient\n\tCodec  runtime.Codec\n\tReq    *http.Request\n\tResp   *http.Response\n\tErr    error\n}\n```\nFakeRESTClient provides a fake RESTClient interface.\n\n```go\nfunc (c *FakeRESTClient) Delete() *Request\n```\n\n```go\nfunc (c *FakeRESTClient) Do(req *http.Request) (*http.Response, error)\n```\n\n```go\nfunc (c *FakeRESTClient) Get() *Request\n```\n\n```go\nfunc (c *FakeRESTClient) Patch(_ api.PatchType) *Request\n```\n\n```go\nfunc (c *FakeRESTClient) Post() *Request\n```\n\n```go\nfunc (c *FakeRESTClient) Put() *Request\n```\n\n```go\ntype FlagSet interface {\n\tStringVar(p *string, name, value, usage string)\n\tBoolVar(p *bool, name string, value bool, usage string)\n\tUintVar(p *uint, name string, value uint, usage string)\n\tDurationVar(p *time.Duration, name string, value time.Duration, usage string)\n\tFloat32Var(p *float32, name string, value float32, usage string)\n\tIntVar(p *int, name string, value int, usage string)\n}\n```\nFlagSet abstracts the flag interface for compatibility with both Golang \"flag\" and cobra pflags (Posix style).\n\n```go\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n```\nHTTPClient is an interface for testing a request object.\n\n```go\ntype HTTPClientFunc func(*http.Request) (*http.Response, error)\n```\n\n```go\nfunc (f HTTPClientFunc) Do(req *http.Request) (*http.Response, error)\n```\n\n```go\ntype HTTPContainerInfoGetter struct {\n\tClient *http.Client\n\tPort   int\n}\n```\n\n```go\nfunc (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)\n```\n\n```go\nfunc (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*cadvisorApi.MachineInfo, error)\n```\n\n```go\nfunc (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)\n```\n\n```go\ntype HTTPKubeletClient struct {\n\tClient *http.Client\n\tConfig *KubeletConfig\n}\n```\nHTTPKubeletClient is the default implementation of KubeletHealthchecker, accesses the kubelet over HTTP.\n\n```go\nfunc (c *HTTPKubeletClient) GetConnectionInfo(host string) (string, uint, http.RoundTripper, error)\n```\n\n```go\nfunc (c *HTTPKubeletClient) HealthCheck(host string) (probe.Result, string, error)\n```\n\n```go\ntype Interface interface {\n\tPodsNamespacer\n\tPodTemplatesNamespacer\n\tReplicationControllersNamespacer\n\tServicesNamespacer\n\tEndpointsNamespacer\n\tVersionInterface\n\tNodesInterface\n\tEventNamespacer\n\tLimitRangesNamespacer\n\tResourceQuotasNamespacer\n\tServiceAccountsNamespacer\n\tSecretsNamespacer\n\tNamespacesInterface\n\tPersistentVolumesInterface\n\tPersistentVolumeClaimsNamespacer\n\tComponentStatusesInterface\n}\n```\nInterface holds the methods for clients of Kubernetes, an interface to allow mock testing.\n\n```go\ntype KubeletClient interface {\n\tKubeletHealthChecker\n\tConnectionInfoGetter\n}\n```\nKubeletClient is an interface for all kubelet functionality\n\n```go\nfunc NewKubeletClient(config *KubeletConfig) (KubeletClient, error)\n```\nTODO: this structure is questionable, it should be using client.Config and overriding defaults.\n\n```go\ntype KubeletConfig struct {\n\t// ToDo: Add support for different kubelet instances exposing different ports\n\tPort        uint\n\tEnableHttps bool\n\n\t// TLSClientConfig contains settings to enable transport layer security\n\tTLSClientConfig\n\n\t// HTTPTimeout is used by the client to timeout http requests to Kubelet.\n\tHTTPTimeout time.Duration\n\n\t// Dial is a custom dialer used for the client\n\tDial func(net, addr string) (net.Conn, error)\n}\n```\n\n```go\ntype KubeletHealthChecker interface {\n\tHealthCheck(host string) (result probe.Result, output string, err error)\n}\n```\nKubeletHealthchecker is an interface for healthchecking kubelets\n\n```go\ntype LimitRangeInterface interface {\n\tList(selector labels.Selector) (*api.LimitRangeList, error)\n\tGet(name string) (*api.LimitRange, error)\n\tDelete(name string) error\n\tCreate(limitRange *api.LimitRange) (*api.LimitRange, error)\n\tUpdate(limitRange *api.LimitRange) (*api.LimitRange, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nLimitRangeInterface has methods to work with LimitRange resources.\n\n```go\ntype LimitRangesNamespacer interface {\n\tLimitRanges(namespace string) LimitRangeInterface\n}\n```\nLimitRangesNamespacer has methods to work with LimitRange resources in a namespace\n\n```go\ntype NamespaceInterface interface {\n\tCreate(item *api.Namespace) (*api.Namespace, error)\n\tGet(name string) (result *api.Namespace, err error)\n\tList(label labels.Selector, field fields.Selector) (*api.NamespaceList, error)\n\tDelete(name string) error\n\tUpdate(item *api.Namespace) (*api.Namespace, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n\tFinalize(item *api.Namespace) (*api.Namespace, error)\n\tStatus(item *api.Namespace) (*api.Namespace, error)\n}\n```\n\n```go\ntype NamespacesInterface interface {\n\tNamespaces() NamespaceInterface\n}\n```\n\n```go\ntype NodeInterface interface {\n\tGet(name string) (result *api.Node, err error)\n\tCreate(node *api.Node) (*api.Node, error)\n\tList(label labels.Selector, field fields.Selector) (*api.NodeList, error)\n\tDelete(name string) error\n\tUpdate(*api.Node) (*api.Node, error)\n\tUpdateStatus(*api.Node) (*api.Node, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\n\n```go\ntype NodesInterface interface {\n\tNodes() NodeInterface\n}\n```\n\n```go\ntype PersistentVolumeClaimInterface interface {\n\tList(label labels.Selector, field fields.Selector) (*api.PersistentVolumeClaimList, error)\n\tGet(name string) (*api.PersistentVolumeClaim, error)\n\tCreate(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)\n\tUpdate(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)\n\tUpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)\n\tDelete(name string) error\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nPersistentVolumeClaimInterface has methods to work with PersistentVolumeClaim resources.\n\n```go\ntype PersistentVolumeClaimsNamespacer interface {\n\tPersistentVolumeClaims(namespace string) PersistentVolumeClaimInterface\n}\n```\nPersistentVolumeClaimsNamespacer has methods to work with PersistentVolumeClaim resources in a namespace\n\n```go\ntype PersistentVolumeInterface interface {\n\tList(label labels.Selector, field fields.Selector) (*api.PersistentVolumeList, error)\n\tGet(name string) (*api.PersistentVolume, error)\n\tCreate(volume *api.PersistentVolume) (*api.PersistentVolume, error)\n\tUpdate(volume *api.PersistentVolume) (*api.PersistentVolume, error)\n\tUpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error)\n\tDelete(name string) error\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nPersistentVolumeInterface has methods to work with PersistentVolume resources.\n\n```go\ntype PersistentVolumesInterface interface {\n\tPersistentVolumes() PersistentVolumeInterface\n}\n```\n\n```go\ntype PodInterface interface {\n\tList(label labels.Selector, field fields.Selector) (*api.PodList, error)\n\tGet(name string) (*api.Pod, error)\n\tDelete(name string, options *api.DeleteOptions) error\n\tCreate(pod *api.Pod) (*api.Pod, error)\n\tUpdate(pod *api.Pod) (*api.Pod, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n\tBind(binding *api.Binding) error\n\tUpdateStatus(pod *api.Pod) (*api.Pod, error)\n}\n```\nPodInterface has methods to work with Pod resources.\n\n```go\ntype PodTemplateInterface interface {\n\tList(label labels.Selector, field fields.Selector) (*api.PodTemplateList, error)\n\tGet(name string) (*api.PodTemplate, error)\n\tDelete(name string, options *api.DeleteOptions) error\n\tCreate(podTemplate *api.PodTemplate) (*api.PodTemplate, error)\n\tUpdate(podTemplate *api.PodTemplate) (*api.PodTemplate, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nPodTemplateInterface has methods to work with PodTemplate resources.\n\n```go\ntype PodTemplatesNamespacer interface {\n\tPodTemplates(namespace string) PodTemplateInterface\n}\n```\nPodTemplatesNamespacer has methods to work with PodTemplate resources in a namespace\n\n```go\ntype PodsNamespacer interface {\n\tPods(namespace string) PodInterface\n}\n```\nPodsNamespacer has methods to work with Pod resources in a namespace\n\n```go\ntype RESTClient struct {\n\n\t// Codec is the encoding and decoding scheme that applies to a particular set of\n\t// REST resources.\n\tCodec runtime.Codec\n\n\t// Set specific behavior of the client.  If not set http.DefaultClient will be\n\t// used.\n\tClient HTTPClient\n\n\tTimeout time.Duration\n\n\t// TODO extract this into a wrapper interface via the RESTClient interface in kubectl.\n\tThrottle util.RateLimiter\n\t// contains filtered or unexported fields\n}\n```\nRESTClient imposes common Kubernetes API conventions on a set of resource paths. The baseURL is expected to point to an HTTP or HTTPS path that is the parent of one or more resources.  The server should return a decodable API resource object, or an api.Status object which contains information about the reason for any failure.\n\nMost consumers should use client.New() to get a Kubernetes API client.\n\n```go\nfunc NewRESTClient(baseURL *url.URL, apiVersion string, c runtime.Codec, maxQPS float32, maxBurst int) *RESTClient\n```\nNewRESTClient creates a new RESTClient. This client performs generic REST functions such as Get, Put, Post, and Delete on specified paths.  Codec controls encoding and decoding of responses from the server.\n\n```go\nfunc RESTClientFor(config *Config) (*RESTClient, error)\n```\nRESTClientFor returns a RESTClient that satisfies the requested attributes on a client Config object. Note that a RESTClient may require fields that are optional when initializing a Client. A RESTClient created by this method is generic - it expects to operate on an API that follows the Kubernetes conventions, but may not be the Kubernetes API.\n\n```go\nfunc (c *RESTClient) APIVersion() string\n```\nAPIVersion returns the APIVersion this RESTClient is expected to use.\n\n```go\nfunc (c *RESTClient) Delete() *Request\n```\nDelete begins a DELETE request. Short for c.Verb(\"DELETE\").\n\n```go\nfunc (c *RESTClient) Get() *Request\n```\nGet begins a GET request. Short for c.Verb(\"GET\").\n\n```go\nfunc (c *RESTClient) Patch(pt api.PatchType) *Request\n```\nPatch begins a PATCH request. Short for c.Verb(\"Patch\").\n\n```go\nfunc (c *RESTClient) Post() *Request\n```\nPost begins a POST request. Short for c.Verb(\"POST\").\n\n```go\nfunc (c *RESTClient) Put() *Request\n```\nPut begins a PUT request. Short for c.Verb(\"PUT\").\n\n```go\nfunc (c *RESTClient) Verb(verb string) *Request\n```\nVerb begins a request with a verb (GET, POST, PUT, DELETE).\n\nExample usage of RESTClient's request building interface: c := NewRESTClient(url, codec) resp, err := c.Verb(\"GET\").\n\n\tPath(\"pods\").\n\tSelectorParam(\"labels\", \"area=staging\").\n\tTimeout(10*time.Second).\n\tDo()\n\nif err != nil { ... } list, ok := resp.(\\*api.PodList)\n\n```go\ntype ReplicationControllerInterface interface {\n\tList(selector labels.Selector) (*api.ReplicationControllerList, error)\n\tGet(name string) (*api.ReplicationController, error)\n\tCreate(ctrl *api.ReplicationController) (*api.ReplicationController, error)\n\tUpdate(ctrl *api.ReplicationController) (*api.ReplicationController, error)\n\tDelete(name string) error\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nReplicationControllerInterface has methods to work with ReplicationController resources.\n\n```go\ntype ReplicationControllersNamespacer interface {\n\tReplicationControllers(namespace string) ReplicationControllerInterface\n}\n```\nReplicationControllersNamespacer has methods to work with ReplicationController resources in a namespace\n\n```go\ntype Request struct {\n\t// contains filtered or unexported fields\n}\n```\nRequest allows for building up a request to a server in a chained fashion. Any errors are stored until the end of your call, so you only have to check once.\n\n```go\nfunc NewRequest(client HTTPClient, verb string, baseURL *url.URL, apiVersion string,\n\tcodec runtime.Codec) *Request\n```\nNewRequest creates a new request helper object for accessing runtime.Objects on a server.\n\n```go\nfunc (r *Request) AbsPath(segments ...string) *Request\n```\nAbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved when a single segment is passed.\n\n```go\nfunc (r *Request) Body(obj interface{}) *Request\n```\nBody makes the request use obj as the body. Optional. If obj is a string, try to read a file of that name. If obj is a \\[]byte, send it directly. If obj is an io.Reader, use it directly. If obj is a runtime.Object, marshal it correctly. Otherwise, set an error.\n\n```go\nfunc (r *Request) Do() Result\n```\nDo formats and executes the request. Returns a Result object for easy response processing.\n\nError type:\n\n  - If the request can't be constructed, or an error happened earlier while building its arguments: \\*RequestConstructionError\n  - If the server responds with a status: \\*errors.StatusError or \\*errors.UnexpectedObjectError\n  - http.Client.Do errors are returned directly.\n\n```go\nfunc (r *Request) DoRaw() ([]byte, error)\n```\nDoRaw executes the request but does not process the response body.\n\n```go\nfunc (r *Request) FieldsSelectorParam(s fields.Selector) *Request\n```\nFieldsSelectorParam adds the given selector as a query parameter with the name paramName.\n\n```go\nfunc (r *Request) LabelsSelectorParam(s labels.Selector) *Request\n```\nLabelsSelectorParam adds the given selector as a query parameter\n\n```go\nfunc (r *Request) Name(resourceName string) *Request\n```\nName sets the name of a resource to access (\\\u003cresource\u003e/\\[ns/\\\u003cnamespace\u003e/]\\\u003cname\u003e)\n\n```go\nfunc (r *Request) Namespace(namespace string) *Request\n```\nNamespace applies the namespace scope to a request (\\\u003cresource\u003e/\\[ns/\\\u003cnamespace\u003e/]\\\u003cname\u003e)\n\n```go\nfunc (r *Request) NamespaceIfScoped(namespace string, scoped bool) *Request\n```\nNamespaceIfScoped is a convenience function to set a namespace if scoped is true\n\n```go\nfunc (r *Request) Param(paramName, s string) *Request\n```\nParam creates a query parameter with the given string value.\n\n```go\nfunc (r *Request) Prefix(segments ...string) *Request\n```\nPrefix adds segments to the relative beginning to the request path. These items will be placed before the optional Namespace, Resource, or Name sections. Setting AbsPath will clear any previously set Prefix segments\n\n```go\nfunc (r *Request) RequestURI(uri string) *Request\n```\nRequestURI overwrites existing path and parameters with the value of the provided server relative URI. Some parameters (those in specialParameters) cannot be overwritten.\n\n```go\nfunc (r *Request) Resource(resource string) *Request\n```\nResource sets the resource to access (\\\u003cresource\u003e/\\[ns/\\\u003cnamespace\u003e/]\\\u003cname\u003e)\n\n```go\nfunc (r *Request) SetHeader(key, value string) *Request\n```\n\n```go\nfunc (r *Request) Stream() (io.ReadCloser, error)\n```\nStream formats and executes the request, and offers streaming of the response. Returns io.ReadCloser which could be used for streaming of the response, or an error Any non-2xx http status code causes an error.  If we get a non-2xx code, we try to convert the body into an APIStatus object. If we can, we return that as an error.  Otherwise, we create an error that lists the http status and the content of the response.\n\n```go\nfunc (r *Request) SubResource(subresources ...string) *Request\n```\nSubResource sets a sub-resource path which can be multiple segments segment after the resource name but before the suffix.\n\n```go\nfunc (r *Request) Suffix(segments ...string) *Request\n```\nSuffix appends segments to the end of the path. These items will be placed after the prefix and optional Namespace, Resource, or Name sections.\n\n```go\nfunc (r *Request) Timeout(d time.Duration) *Request\n```\nTimeout makes the request use the given duration as a timeout. Sets the \"timeout\" parameter.\n\n```go\nfunc (r *Request) URL() *url.URL\n```\nURL returns the current working URL.\n\n```go\nfunc (r *Request) UintParam(paramName string, u uint64) *Request\n```\nUintParam creates a query parameter with the given value.\n\n```go\nfunc (r *Request) UnversionedPath(segments ...string) *Request\n```\nUnversionedPath strips the apiVersion from the baseURL before appending segments.\n\n```go\nfunc (r *Request) Upgrade(config *Config, newRoundTripperFunc func(*tls.Config) httpstream.UpgradeRoundTripper) (httpstream.Connection, error)\n```\nUpgrade upgrades the request so that it supports multiplexed bidirectional streams. The current implementation uses SPDY, but this could be replaced with HTTP/2 once it's available, or something else.\n\n```go\nfunc (r *Request) Watch() (watch.Interface, error)\n```\nWatch attempts to begin watching the requested location. Returns a watch.Interface, or an error.\n\n```go\ntype RequestConstructionError struct {\n\tErr error\n}\n```\nRequestConstructionError is returned when there's an error assembling a request.\n\n```go\nfunc (r *RequestConstructionError) Error() string\n```\nError returns a textual description of 'r'.\n\n```go\ntype RequestInfo struct {\n\tRequestHeaders http.Header\n\tRequestVerb    string\n\tRequestURL     string\n\n\tResponseStatus  string\n\tResponseHeaders http.Header\n\tResponseErr     error\n\n\tDuration time.Duration\n}\n```\nRequestInfo keeps track of information about a request/response combination\n\n```go\nfunc NewRequestInfo(req *http.Request) *RequestInfo\n```\nNewRequestInfo creates a new RequestInfo based on an http request\n\n```go\nfunc (r *RequestInfo) Complete(response *http.Response, err error)\n```\nComplete adds information about the response to the RequestInfo\n\n```go\nfunc (r RequestInfo) ToCurl() string\n```\nToCurl returns a string that can be run as a command in a terminal (minus the body)\n\n```go\ntype ResourceQuotaInterface interface {\n\tList(selector labels.Selector) (*api.ResourceQuotaList, error)\n\tGet(name string) (*api.ResourceQuota, error)\n\tDelete(name string) error\n\tCreate(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)\n\tUpdate(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)\n\tUpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nResourceQuotaInterface has methods to work with ResourceQuota resources.\n\n```go\ntype ResourceQuotasNamespacer interface {\n\tResourceQuotas(namespace string) ResourceQuotaInterface\n}\n```\nResourceQuotasNamespacer has methods to work with ResourceQuota resources in a namespace\n\n```go\ntype Result struct {\n\t// contains filtered or unexported fields\n}\n```\nResult contains the result of calling Request.Do().\n\n```go\nfunc (r Result) Error() error\n```\nError returns the error executing the request, nil if no error occurred. See the Request.Do() comment for what errors you might get.\n\n```go\nfunc (r Result) Get() (runtime.Object, error)\n```\nGet returns the result as an object.\n\n```go\nfunc (r Result) Into(obj runtime.Object) error\n```\nInto stores the result into obj, if possible.\n\n```go\nfunc (r Result) Raw() ([]byte, error)\n```\nRaw returns the raw result.\n\n```go\nfunc (r Result) StatusCode(statusCode *int) Result\n```\nStatusCode returns the HTTP status code of the request. (Only valid if no error was returned.)\n\n```go\nfunc (r Result) WasCreated(wasCreated *bool) Result\n```\nWasCreated updates the provided bool pointer to whether the server returned 201 created or a different response.\n\n```go\ntype SecretsInterface interface {\n\tCreate(secret *api.Secret) (*api.Secret, error)\n\tUpdate(secret *api.Secret) (*api.Secret, error)\n\tDelete(name string) error\n\tList(label labels.Selector, field fields.Selector) (*api.SecretList, error)\n\tGet(name string) (*api.Secret, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\n\n```go\ntype SecretsNamespacer interface {\n\tSecrets(namespace string) SecretsInterface\n}\n```\n\n```go\ntype ServiceAccountsInterface interface {\n\tCreate(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)\n\tUpdate(serviceAccount *api.ServiceAccount) (*api.ServiceAccount, error)\n\tDelete(name string) error\n\tList(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error)\n\tGet(name string) (*api.ServiceAccount, error)\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\n\n```go\ntype ServiceAccountsNamespacer interface {\n\tServiceAccounts(namespace string) ServiceAccountsInterface\n}\n```\n\n```go\ntype ServiceInterface interface {\n\tList(selector labels.Selector) (*api.ServiceList, error)\n\tGet(name string) (*api.Service, error)\n\tCreate(srv *api.Service) (*api.Service, error)\n\tUpdate(srv *api.Service) (*api.Service, error)\n\tDelete(name string) error\n\tWatch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)\n}\n```\nServiceInterface has methods to work with Service resources.\n\n```go\ntype ServicesNamespacer interface {\n\tServices(namespace string) ServiceInterface\n}\n```\nServicesNamespacer has methods to work with Service resources in a namespace\n\n```go\ntype TLSClientConfig struct {\n\t// Server requires TLS client certificate authentication\n\tCertFile string\n\t// Server requires TLS client certificate authentication\n\tKeyFile string\n\t// Trusted root certificates for server\n\tCAFile string\n\n\t// CertData holds PEM-encoded bytes (typically read from a client certificate file).\n\t// CertData takes precedence over CertFile\n\tCertData []byte\n\t// KeyData holds PEM-encoded bytes (typically read from a client certificate key file).\n\t// KeyData takes precedence over KeyFile\n\tKeyData []byte\n\t// CAData holds PEM-encoded bytes (typically read from a root certificates bundle).\n\t// CAData takes precedence over CAFile\n\tCAData []byte\n}\n```\nTLSClientConfig contains settings to enable transport layer security\n\n```go\ntype VersionInterface interface {\n\tServerVersion() (*version.Info, error)\n\tServerAPIVersions() (*api.APIVersions, error)\n}\n```\nVersionInterface has a method to retrieve the server version.\n\n","path":"github.com/dockerstack/kubernetes/pkg/client","name":"client","synopsis":"Package client contains the implementation of the client side communication with the Kubernetes master.","isRedistributable":true}
