api

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api ...

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPodName = errors.New("no pod name provided")
	ErrNotFound  = errors.New("pod not found")
	ErrDecode    = errors.New("error decoding")
	ErrOther     = errors.New("unspecified error occurred in k8s registry")
)

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 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) 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 parameters 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) Decode

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

Decode decodes body into `data`.

func (*Response) Error

func (r *Response) Error() error

Error returns an error.

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