kubernetes: github.com/igm/kubernetes/pkg/client Index | Files | Directories

package client

import "github.com/igm/kubernetes/pkg/client"

Package 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.

Most consumers should use the Config object to create a Client:

config := &client.Config{
  Host:     "http://localhost:8080",
  Username: "test",
  Password: "password",
}
client, err := client.New(&config)
if err != nil {
  // handle error
}
client.ListPods()

More advanced consumers may wish to provide their own transport via a http.RoundTripper:

config := &client.Config{
  Host:      "https://localhost:8080",
  Transport: oauthclient.Transport(),
}
client, err := client.New(&config)

The 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.

Index

Package Files

client.go conditions.go containerinfo.go doc.go endpoints.go events.go fake.go fake_endpoints.go fake_events.go fake_minions.go fake_pods.go fake_replication_controllers.go fake_services.go flags.go helper.go kubelet.go minions.go pods.go replication_controllers.go request.go restclient.go services.go transport.go

Variables

var ErrPodInfoNotAvailable = errors.New("no pod info available")

ErrPodInfoNotAvailable may be returned when the requested pod info is not available.

func BindClientConfigFlags Uses

func BindClientConfigFlags(flags FlagSet, config *Config)

BindClientConfigFlags 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

func BindKubeletClientConfigFlags Uses

func BindKubeletClientConfigFlags(flags FlagSet, config *KubeletConfig)

func DefaultServerURL Uses

func DefaultServerURL(host, prefix, version string, defaultTLS bool) (*url.URL, error)

DefaultServerURL 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.

func IsConfigTransportTLS Uses

func IsConfigTransportTLS(config *Config) bool

IsConfigTransportTLS 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.

Note: the Insecure flag is ignored when testing for this value, so MITM attacks are still possible.

func NewBasicAuthRoundTripper Uses

func NewBasicAuthRoundTripper(username, password string, rt http.RoundTripper) http.RoundTripper

func NewBearerAuthRoundTripper Uses

func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper

func NewClientCertTLSTransport Uses

func NewClientCertTLSTransport(certFile, keyFile, caFile string) (*http.Transport, error)

func NewUnsafeTLSTransport Uses

func NewUnsafeTLSTransport() *http.Transport

func TransportFor Uses

func TransportFor(config *Config) (http.RoundTripper, error)

TransportFor 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.

type APIStatus Uses

type APIStatus interface {
    Status() api.Status
}

APIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.

type Client Uses

type Client struct {
    *RESTClient
}

Client is the implementation of a Kubernetes client.

func New Uses

func New(c *Config) (*Client, error)

New 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.

func NewOrDie Uses

func NewOrDie(c *Config) *Client

NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.

func (*Client) ControllerHasDesiredReplicas Uses

func (c *Client) ControllerHasDesiredReplicas(controller api.ReplicationController) wait.ConditionFunc

ControllerHasDesiredReplicas returns a condition that will be true iff the desired replica count for a controller's ReplicaSelector equals the Replicas count.

func (*Client) Endpoints Uses

func (c *Client) Endpoints(namespace string) EndpointsInterface

func (*Client) Events Uses

func (c *Client) Events(namespace string) EventInterface

func (*Client) Minions Uses

func (c *Client) Minions() MinionInterface

func (*Client) Pods Uses

func (c *Client) Pods(namespace string) PodInterface

func (*Client) ReplicationControllers Uses

func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface

func (*Client) ServerAPIVersions Uses

func (c *Client) ServerAPIVersions() (*api.APIVersions, error)

ServerAPIVersions retrieves and parses the list of API versions the server supports.

func (*Client) ServerVersion Uses

func (c *Client) ServerVersion() (*version.Info, error)

ServerVersion retrieves and parses the server's version.

func (*Client) Services Uses

func (c *Client) Services(namespace string) ServiceInterface

type Config Uses

type Config struct {
    // Host must be a host string, a host:port pair, or a URL to the base of the API.
    Host string
    // Prefix is the sub path of the server. If not specified, the client will set
    // a default value.  Use "/" to indicate the server root should be used
    Prefix string
    // Version is the API version to talk to. If not specified, the client will use
    // the preferred version.
    Version string

    // Server requires Basic authentication
    Username string
    Password string

    // Server requires Bearer authentication. This client will not attempt to use
    // refresh tokens for an OAuth2 flow.
    // TODO: demonstrate an OAuth2 compatible client.
    BearerToken string

    // Server requires TLS client certificate authentication
    CertFile string
    KeyFile  string
    CAFile   string

    // Server should be accessed without verifying the TLS
    // certificate. For testing only.
    Insecure bool

    // Transport may be used for custom HTTP behavior. This attribute may not
    // be specified with the TLS client certificate options.
    Transport http.RoundTripper
}

Config holds the common attributes that can be passed to a Kubernetes client on initialization.

type ContainerInfoGetter Uses

type ContainerInfoGetter interface {
    // GetContainerInfo returns information about a container.
    GetContainerInfo(host, podID, containerID string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
    // GetRootInfo returns information about the root container on a machine.
    GetRootInfo(host string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
    // GetMachineInfo returns the machine's information like number of cores, memory capacity.
    GetMachineInfo(host string) (*info.MachineInfo, error)
}

type EndpointsInterface Uses

type EndpointsInterface interface {
    Create(endpoints *api.Endpoints) (*api.Endpoints, error)
    List(selector labels.Selector) (*api.EndpointsList, error)
    Get(id string) (*api.Endpoints, error)
    Update(endpoints *api.Endpoints) (*api.Endpoints, error)
    Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)
}

EndpointsInterface has methods to work with Endpoints resources

type EndpointsNamespacer Uses

type EndpointsNamespacer interface {
    Endpoints(namespace string) EndpointsInterface
}

EndpointsNamespacer has methods to work with Endpoints resources in a namespace

type EventInterface Uses

type EventInterface interface {
    Create(event *api.Event) (*api.Event, error)
    List(label, field labels.Selector) (*api.EventList, error)
    Get(id string) (*api.Event, error)
    Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)
    // Search finds events about the specified object
    Search(objOrRef runtime.Object) (*api.EventList, error)
}

EventInterface has methods to work with Event resources

type EventNamespacer Uses

type EventNamespacer interface {
    Events(namespace string) EventInterface
}

EventNamespacer can return an EventInterface for the given namespace.

type Fake Uses

type Fake struct {
    Actions       []FakeAction
    PodsList      api.PodList
    Ctrl          api.ReplicationController
    ServiceList   api.ServiceList
    EndpointsList api.EndpointsList
    MinionsList   api.MinionList
    EventsList    api.EventList
    Err           error
    Watch         watch.Interface
}

Fake implements Interface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*Fake) Endpoints Uses

func (c *Fake) Endpoints(namespace string) EndpointsInterface

func (*Fake) Events Uses

func (c *Fake) Events(namespace string) EventInterface

func (*Fake) Minions Uses

func (c *Fake) Minions() MinionInterface

func (*Fake) Pods Uses

func (c *Fake) Pods(namespace string) PodInterface

func (*Fake) ReplicationControllers Uses

func (c *Fake) ReplicationControllers(namespace string) ReplicationControllerInterface

func (*Fake) ServerAPIVersions Uses

func (c *Fake) ServerAPIVersions() (*api.APIVersions, error)

func (*Fake) ServerVersion Uses

func (c *Fake) ServerVersion() (*version.Info, error)

func (*Fake) Services Uses

func (c *Fake) Services(namespace string) ServiceInterface

type FakeAction Uses

type FakeAction struct {
    Action string
    Value  interface{}
}

type FakeEndpoints Uses

type FakeEndpoints struct {
    Fake      *Fake
    Namespace string
}

FakeEndpoints implements EndpointInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeEndpoints) Create Uses

func (c *FakeEndpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error)

func (*FakeEndpoints) Get Uses

func (c *FakeEndpoints) Get(name string) (*api.Endpoints, error)

func (*FakeEndpoints) List Uses

func (c *FakeEndpoints) List(selector labels.Selector) (*api.EndpointsList, error)

func (*FakeEndpoints) Update Uses

func (c *FakeEndpoints) Update(endpoints *api.Endpoints) (*api.Endpoints, error)

func (*FakeEndpoints) Watch Uses

func (c *FakeEndpoints) Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)

type FakeEvents Uses

type FakeEvents struct {
    Fake *Fake
}

FakeEvents implements EventInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeEvents) Create Uses

func (c *FakeEvents) Create(event *api.Event) (*api.Event, error)

Create makes a new event. Returns the copy of the event the server returns, or an error.

func (*FakeEvents) Get Uses

func (c *FakeEvents) Get(id string) (*api.Event, error)

Get returns the given event, or an error.

func (*FakeEvents) List Uses

func (c *FakeEvents) List(label, field labels.Selector) (*api.EventList, error)

List returns a list of events matching the selectors.

func (*FakeEvents) Search Uses

func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error)

Search returns a list of events matching the specified object.

func (*FakeEvents) Watch Uses

func (c *FakeEvents) Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)

Watch starts watching for events matching the given selectors.

type FakeKubeletClient Uses

type FakeKubeletClient struct{}

FakeKubeletClient 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.

func (FakeKubeletClient) GetPodInfo Uses

func (c FakeKubeletClient) GetPodInfo(host, podNamespace string, podID string) (api.PodInfo, error)

GetPodInfo is a fake implementation of PodInfoGetter.GetPodInfo.

func (FakeKubeletClient) HealthCheck Uses

func (c FakeKubeletClient) HealthCheck(host string) (health.Status, error)

type FakeMinions Uses

type FakeMinions struct {
    Fake *Fake
}

FakeMinions implements MinionInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeMinions) Create Uses

func (c *FakeMinions) Create(minion *api.Minion) (*api.Minion, error)

func (*FakeMinions) Delete Uses

func (c *FakeMinions) Delete(id string) error

func (*FakeMinions) Get Uses

func (c *FakeMinions) Get(name string) (*api.Minion, error)

func (*FakeMinions) List Uses

func (c *FakeMinions) List() (*api.MinionList, error)

type FakePods Uses

type FakePods struct {
    Fake      *Fake
    Namespace string
}

FakePods implements PodsInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the methods you want to test easier.

func (*FakePods) Create Uses

func (c *FakePods) Create(pod *api.Pod) (*api.Pod, error)

func (*FakePods) Delete Uses

func (c *FakePods) Delete(name string) error

func (*FakePods) Get Uses

func (c *FakePods) Get(name string) (*api.Pod, error)

func (*FakePods) List Uses

func (c *FakePods) List(selector labels.Selector) (*api.PodList, error)

func (*FakePods) Update Uses

func (c *FakePods) Update(pod *api.Pod) (*api.Pod, error)

type FakeRESTClient Uses

type FakeRESTClient struct {
    Client HTTPClient
    Codec  runtime.Codec
    Req    *http.Request
    Resp   *http.Response
    Err    error
}

FakeRESTClient provides a fake RESTClient interface.

func (*FakeRESTClient) Delete Uses

func (c *FakeRESTClient) Delete() *Request

func (*FakeRESTClient) Do Uses

func (c *FakeRESTClient) Do(req *http.Request) (*http.Response, error)

func (*FakeRESTClient) Get Uses

func (c *FakeRESTClient) Get() *Request

func (*FakeRESTClient) Post Uses

func (c *FakeRESTClient) Post() *Request

func (*FakeRESTClient) Put Uses

func (c *FakeRESTClient) Put() *Request

type FakeReplicationControllers Uses

type FakeReplicationControllers struct {
    Fake      *Fake
    Namespace string
}

FakeReplicationControllers implements ReplicationControllerInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeReplicationControllers) Create Uses

func (c *FakeReplicationControllers) Create(controller *api.ReplicationController) (*api.ReplicationController, error)

func (*FakeReplicationControllers) Delete Uses

func (c *FakeReplicationControllers) Delete(controller string) error

func (*FakeReplicationControllers) Get Uses

func (c *FakeReplicationControllers) Get(name string) (*api.ReplicationController, error)

func (*FakeReplicationControllers) List Uses

func (c *FakeReplicationControllers) List(selector labels.Selector) (*api.ReplicationControllerList, error)

func (*FakeReplicationControllers) Update Uses

func (c *FakeReplicationControllers) Update(controller *api.ReplicationController) (*api.ReplicationController, error)

func (*FakeReplicationControllers) Watch Uses

func (c *FakeReplicationControllers) Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)

type FakeServices Uses

type FakeServices struct {
    Fake      *Fake
    Namespace string
}

Fake implements ServiceInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeServices) Create Uses

func (c *FakeServices) Create(service *api.Service) (*api.Service, error)

func (*FakeServices) Delete Uses

func (c *FakeServices) Delete(service string) error

func (*FakeServices) Get Uses

func (c *FakeServices) Get(name string) (*api.Service, error)

func (*FakeServices) List Uses

func (c *FakeServices) List(selector labels.Selector) (*api.ServiceList, error)

func (*FakeServices) Update Uses

func (c *FakeServices) Update(service *api.Service) (*api.Service, error)

func (*FakeServices) Watch Uses

func (c *FakeServices) Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)

type FlagSet Uses

type FlagSet interface {
    StringVar(p *string, name, value, usage string)
    BoolVar(p *bool, name string, value bool, usage string)
    UintVar(p *uint, name string, value uint, usage string)
}

FlagSet abstracts the flag interface for compatibility with both Golang "flag" and cobra pflags (Posix style).

type HTTPClient Uses

type HTTPClient interface {
    Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for testing a request object.

type HTTPContainerInfoGetter Uses

type HTTPContainerInfoGetter struct {
    Client *http.Client
    Port   int
}

func (*HTTPContainerInfoGetter) GetContainerInfo Uses

func (self *HTTPContainerInfoGetter) GetContainerInfo(host, podID, containerID string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)

func (*HTTPContainerInfoGetter) GetMachineInfo Uses

func (self *HTTPContainerInfoGetter) GetMachineInfo(host string) (*info.MachineInfo, error)

func (*HTTPContainerInfoGetter) GetRootInfo Uses

func (self *HTTPContainerInfoGetter) GetRootInfo(host string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)

type HTTPKubeletClient Uses

type HTTPKubeletClient struct {
    Client      *http.Client
    Port        uint
    EnableHttps bool
}

HTTPKubeletClient is the default implementation of PodInfoGetter and KubeletHealthchecker, accesses the kubelet over HTTP.

func (*HTTPKubeletClient) GetPodInfo Uses

func (c *HTTPKubeletClient) GetPodInfo(host, podNamespace, podID string) (api.PodInfo, error)

GetPodInfo gets information about the specified pod.

func (*HTTPKubeletClient) HealthCheck Uses

func (c *HTTPKubeletClient) HealthCheck(host string) (health.Status, error)

type HttpClientFunc Uses

type HttpClientFunc func(*http.Request) (*http.Response, error)

func (HttpClientFunc) Do Uses

func (f HttpClientFunc) Do(req *http.Request) (*http.Response, error)

type Interface Uses

type Interface interface {
    PodsNamespacer
    ReplicationControllersNamespacer
    ServicesNamespacer
    EndpointsNamespacer
    VersionInterface
    MinionsInterface
    EventNamespacer
}

Interface holds the methods for clients of Kubernetes, an interface to allow mock testing.

type KubeletClient Uses

type KubeletClient interface {
    KubeletHealthChecker
    PodInfoGetter
}

KubeletClient is an interface for all kubelet functionality

func NewKubeletClient Uses

func NewKubeletClient(config *KubeletConfig) (KubeletClient, error)

type KubeletConfig Uses

type KubeletConfig struct {
    // ToDo: Add support for different kubelet instances exposing different ports
    Port        uint
    EnableHttps bool

    // TLS Configuration, only applies if EnableHttps is true.
    CertFile string
    // TLS Configuration, only applies if EnableHttps is true.
    KeyFile string
    // TLS Configuration, only applies if EnableHttps is true.
    CAFile string
}

type KubeletHealthChecker Uses

type KubeletHealthChecker interface {
    HealthCheck(host string) (health.Status, error)
}

KubeletHealthchecker is an interface for healthchecking kubelets

type MinionInterface Uses

type MinionInterface interface {
    Get(id string) (result *api.Minion, err error)
    Create(minion *api.Minion) (*api.Minion, error)
    List() (*api.MinionList, error)
    Delete(id string) error
}

type MinionsInterface Uses

type MinionsInterface interface {
    Minions() MinionInterface
}

type PodInfoGetter Uses

type PodInfoGetter interface {
    // GetPodInfo returns information about all containers which are part
    // Returns an api.PodInfo, or an error if one occurs.
    GetPodInfo(host, podNamespace, podID string) (api.PodInfo, error)
}

PodInfoGetter is an interface for things that can get information about a pod's containers. Injectable for easy testing.

type PodInterface Uses

type PodInterface interface {
    List(selector labels.Selector) (*api.PodList, error)
    Get(name string) (*api.Pod, error)
    Delete(name string) error
    Create(pod *api.Pod) (*api.Pod, error)
    Update(pod *api.Pod) (*api.Pod, error)
}

PodInterface has methods to work with Pod resources.

type PodsNamespacer Uses

type PodsNamespacer interface {
    Pods(namespace string) PodInterface
}

PodsNamespacer has methods to work with Pod resources in a namespace

type PollFunc Uses

type PollFunc func(name string) (*Request, bool)

PollFunc is called when a server operation returns 202 accepted. The name of the operation is extracted from the response and passed to this function. Return a request to retrieve the result of the operation, or false for the second argument if polling should end.

type RESTClient Uses

type RESTClient struct {

    // Codec is the encoding and decoding scheme that applies to a particular set of
    // REST resources.
    Codec runtime.Codec

    // Set specific behavior of the client.  If not set http.DefaultClient will be
    // used.
    Client HTTPClient

    // Set the poll behavior of this client. If not set the DefaultPoll method will
    // be called.
    Poller PollFunc

    Sync       bool
    PollPeriod time.Duration
    Timeout    time.Duration
    // contains filtered or unexported fields
}

RESTClient 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.

Most consumers should use client.New() to get a Kubernetes API client.

func NewRESTClient Uses

func NewRESTClient(baseURL *url.URL, c runtime.Codec) *RESTClient

NewRESTClient 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.

func RESTClientFor Uses

func RESTClientFor(config *Config) (*RESTClient, error)

RESTClientFor returns a RESTClient that satisfies the requested attributes on a client Config object.

func (*RESTClient) DefaultPoll Uses

func (c *RESTClient) DefaultPoll(name string) (*Request, bool)

func (*RESTClient) Delete Uses

func (c *RESTClient) Delete() *Request

Delete begins a DELETE request. Short for c.Verb("DELETE").

func (*RESTClient) Get Uses

func (c *RESTClient) Get() *Request

Get begins a GET request. Short for c.Verb("GET").

func (*RESTClient) Operation Uses

func (c *RESTClient) Operation(name string) *Request

PollFor makes a request to do a single poll of the completion of the given operation.

func (*RESTClient) Post Uses

func (c *RESTClient) Post() *Request

Post begins a POST request. Short for c.Verb("POST").

func (*RESTClient) Put Uses

func (c *RESTClient) Put() *Request

Put begins a PUT request. Short for c.Verb("PUT").

func (*RESTClient) Verb Uses

func (c *RESTClient) Verb(verb string) *Request

Verb begins a request with a verb (GET, POST, PUT, DELETE).

Example usage of RESTClient's request building interface: c := NewRESTClient(url, codec) resp, err := c.Verb("GET").

Path("pods").
SelectorParam("labels", "area=staging").
Timeout(10*time.Second).
Do()

if err != nil { ... } list, ok := resp.(*api.PodList)

type ReplicationControllerInterface Uses

type ReplicationControllerInterface interface {
    List(selector labels.Selector) (*api.ReplicationControllerList, error)
    Get(name string) (*api.ReplicationController, error)
    Create(ctrl *api.ReplicationController) (*api.ReplicationController, error)
    Update(ctrl *api.ReplicationController) (*api.ReplicationController, error)
    Delete(name string) error
    Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)
}

ReplicationControllerInterface has methods to work with ReplicationController resources.

type ReplicationControllersNamespacer Uses

type ReplicationControllersNamespacer interface {
    ReplicationControllers(namespace string) ReplicationControllerInterface
}

ReplicationControllersNamespacer has methods to work with ReplicationController resources in a namespace

type Request Uses

type Request struct {
    // contains filtered or unexported fields
}

Request 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.

func NewRequest Uses

func NewRequest(client HTTPClient, verb string, baseURL *url.URL, codec runtime.Codec) *Request

NewRequest creates a new request with the core attributes.

func (*Request) AbsPath Uses

func (r *Request) AbsPath(path string) *Request

AbsPath overwrites an existing path with the path parameter.

func (*Request) Body Uses

func (r *Request) Body(obj interface{}) *Request

Body 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.

func (*Request) Do Uses

func (r *Request) Do() Result

Do formats and executes the request. Returns a Result object for easy response processing. Handles polling the server in the event a continuation was sent.

Error type:

* If the request can't be constructed, or an error happened earlier while building its
  arguments: *RequestConstructionError
* If the server responds with a status: *errors.StatusError or *errors.UnexpectedObjectError
* If the status code and body don't make sense together: *UnexpectedStatusError
* http.Client.Do errors are returned directly.

func (*Request) Namespace Uses

func (r *Request) Namespace(namespace string) *Request

Namespace applies the namespace scope to a request

func (*Request) NoPoll Uses

func (r *Request) NoPoll() *Request

NoPoll indicates a server "working" response should be returned as an error

func (*Request) Param Uses

func (r *Request) Param(paramName, s string) *Request

Param creates a query parameter with the given string value.

func (*Request) ParseSelectorParam Uses

func (r *Request) ParseSelectorParam(paramName, item string) *Request

ParseSelectorParam parses the given string as a resource label selector. This is a convenience function so you don't have to first check that it's a validly formatted selector.

func (*Request) Path Uses

func (r *Request) Path(item string) *Request

Path appends an item to the request path. You must call Path at least once.

func (*Request) Poller Uses

func (r *Request) Poller(poller PollFunc) *Request

Poller indicates this request should use the specified poll function to determine whether a server "working" response should be retried. The poller is responsible for waiting or outputting messages to the client.

func (*Request) SelectorParam Uses

func (r *Request) SelectorParam(paramName string, s labels.Selector) *Request

SelectorParam adds the given selector as a query parameter with the name paramName.

func (*Request) Stream Uses

func (r *Request) Stream() (io.ReadCloser, error)

Stream 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

func (*Request) Sync Uses

func (r *Request) Sync(sync bool) *Request

Sync sets sync/async call status by setting the "sync" parameter to "true"/"false".

func (*Request) Timeout Uses

func (r *Request) Timeout(d time.Duration) *Request

Timeout makes the request use the given duration as a timeout. Sets the "timeout" parameter. Ignored if sync=false.

func (*Request) UintParam Uses

func (r *Request) UintParam(paramName string, u uint64) *Request

UintParam creates a query parameter with the given value.

func (*Request) Watch Uses

func (r *Request) Watch() (watch.Interface, error)

Watch attempts to begin watching the requested location. Returns a watch.Interface, or an error.

type RequestConstructionError Uses

type RequestConstructionError struct {
    Err error
}

RequestConstructionError is returned when there's an error assembling a request.

func (*RequestConstructionError) Error Uses

func (r *RequestConstructionError) Error() string

Error returns a textual description of 'r'.

type Result Uses

type Result struct {
    // contains filtered or unexported fields
}

Result contains the result of calling Request.Do().

func (Result) Error Uses

func (r Result) Error() error

Error returns the error executing the request, nil if no error occurred. See the Request.Do() comment for what errors you might get.

func (Result) Get Uses

func (r Result) Get() (runtime.Object, error)

Get returns the result as an object.

func (Result) Into Uses

func (r Result) Into(obj runtime.Object) error

Into stores the result into obj, if possible.

func (Result) Raw Uses

func (r Result) Raw() ([]byte, error)

Raw returns the raw result.

func (Result) WasCreated Uses

func (r Result) WasCreated(wasCreated *bool) Result

WasCreated updates the provided bool pointer to whether the server returned 201 created or a different response.

type ServiceInterface Uses

type ServiceInterface interface {
    List(selector labels.Selector) (*api.ServiceList, error)
    Get(name string) (*api.Service, error)
    Create(srv *api.Service) (*api.Service, error)
    Update(srv *api.Service) (*api.Service, error)
    Delete(name string) error
    Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error)
}

ServiceInterface has methods to work with Service resources.

type ServicesNamespacer Uses

type ServicesNamespacer interface {
    Services(namespace string) ServiceInterface
}

ServicesNamespacer has methods to work with Service resources in a namespace

type UnexpectedStatusError Uses

type UnexpectedStatusError struct {
    Request  *http.Request
    Response *http.Response
    Body     string
}

UnexpectedStatusError is returned as an error if a response's body and HTTP code don't make sense together.

func (*UnexpectedStatusError) Error Uses

func (u *UnexpectedStatusError) Error() string

Error returns a textual description of 'u'.

type VersionInterface Uses

type VersionInterface interface {
    ServerVersion() (*version.Info, error)
    ServerAPIVersions() (*api.APIVersions, error)
}

VersionInterface has a method to retrieve the server version.

Directories

PathSynopsis
cachePackage cache is a client-side caching mechanism.
clientcmdPackage cmd provides one stop shopping for a command line executable to bind the correct flags, build the client config, and create a working client.
recordPackage record has all client logic for recording and reporting events.

Package client imports 28 packages (graph). Updated 2018-04-17. Refresh now. Tools for package owners.