api

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("K8s: not found")
	ErrDecode   = errors.New("K8s: error decoding")
	ErrOther    = errors.New("K8s: error")
)

Errors ...

Functions

This section is empty.

Types

type Options

type Options struct {
	Host        string
	Namespace   string
	BearerToken *string
	Client      *http.Client
}

Options ...

type Params

type Params struct {
	LabelSelector map[string]string
	Watch         bool
}

Params is the object to pass in to set paramaters on a request.

type Request

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

Request is used to construct a http request for the k8s API.

func NewRequest

func NewRequest(opts *Options) *Request

NewRequest creates a k8s api request

func (*Request) Body

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

Body pass in a body to set, this is for POST, PUT and PATCH requests

func (*Request) Delete

func (r *Request) Delete() *Request

Delete request

func (*Request) Do

func (r *Request) Do() *Response

Do builds and triggers the request

func (*Request) Get

func (r *Request) Get() *Request

Get request

func (*Request) Name

func (r *Request) Name(s string) *Request

Name is for targeting a specific resource by id

func (*Request) Namespace

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

Namespace is to set the namespace to operate on

func (*Request) Params

func (r *Request) Params(p *Params) *Request

Params isused to set paramters on a request

func (*Request) Post

func (r *Request) Post() *Request

Post request

func (*Request) Put

func (r *Request) Put() *Request

Put request

func (*Request) Resource

func (r *Request) Resource(s string) *Request

Resource is the type of resource the operation is for, such as "services", "endpoints" or "pods"

func (*Request) SetHeader

func (r *Request) SetHeader(key, value string) *Request

SetHeader sets a header on a request with a `key` and `value`

func (*Request) Watch

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

Watch builds and triggers the request, but will watch instead of return an object

type Response

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

Response ...

func (*Response) Error

func (r *Response) Error() error

Error returns an error

func (*Response) Into

func (r *Response) Into(data interface{}) error

Into decode body into `data`

func (*Response) StatusCode

func (r *Response) StatusCode() int

StatusCode returns status code for response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL