api

package
v2.9.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("kubernetes: resource not found")
	ErrDecode   = errors.New("kubernetes: error decoding")
	ErrUnknown  = errors.New("kubernetes: unknown 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
	Annotations   map[string]string
	Additional    map[string]string
}

Params is the object to pass in to set parameters 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) Context

func (r *Request) Context(ctx context.Context)

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) Patch

func (r *Request) Patch() *Request

Patch request

func (*Request) Post

func (r *Request) Post() *Request

Post request

func (*Request) Put

func (r *Request) Put() *Request

Put request

func (*Request) Raw

func (r *Request) Raw() (*http.Response, error)

Raw performs a Raw HTTP request to the Kubernetes API

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) SubResource

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

SubResource sets a subresource on a resource, e.g. pods/log for pod logs

type Response

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

Response ...

func (*Response) Close

func (r *Response) Close() error

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

type Status

type Status struct {
	Kind    string `json:"kind"`
	Status  string `json:"status"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
	Code    int    `json:"code"`
}

Status is an object that is returned when a request failed or delete succeeded.

Jump to

Keyboard shortcuts

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