client

package
v0.0.0-...-694227f Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplyPatchHeader = Header{
	Name:  "content-type",
	Value: "application/apply-patch+yaml",
}
View Source
var MergePatchHeader = Header{
	Name:  "content-type",
	Value: "application/merge-patch+json",
}

Functions

func NewObjectAPI

func NewObjectAPI[T interface{}](kc Interface, gvr types.GroupVersionResource, opt ...ObjectAPIOption) types.ObjectAPI[T]

Types

type DefaultClient

type DefaultClient struct {
	HttpClient *http.Client
	// contains filtered or unexported fields
}

func NewInCluster

func NewInCluster() (*DefaultClient, error)

NewInCluster creates Client if it is inside Kubernetes.

func (*DefaultClient) APIServerURL

func (kc *DefaultClient) APIServerURL() string

func (*DefaultClient) Do

func (kc *DefaultClient) Do(req *http.Request) (*http.Response, error)

func (*DefaultClient) Token

func (kc *DefaultClient) Token() string

type DefaultLogger

type DefaultLogger struct {
}

func (*DefaultLogger) Infof

func (l *DefaultLogger) Infof(format string, args ...any)
type Header struct {
	Name  string
	Value string
}

type Interface

type Interface interface {
	// Do sends HTTP request to ObjectAPI server.
	Do(req *http.Request) (*http.Response, error)
	// Token returns current access token.
	Token() string
	// APIServerURL returns API server URL.
	APIServerURL() string
}

Interface is minimal kubernetes Client interface.

type Logger

type Logger interface {
	Infof(format string, args ...any)
}

type ObjectAPIOption

type ObjectAPIOption func(opts *objectAPIOptions)

func WithLogger

func WithLogger(log Logger) ObjectAPIOption

func WithResponseDecoder

func WithResponseDecoder(decoderFunc ResponseDecoderFunc) ObjectAPIOption

type ResourceRequest

type ResourceRequest struct {
	Verb      string
	Namespace string
	Name      string
	Extra     []string
	Body      io.Reader
}

type ResponseDecoder

type ResponseDecoder interface {
	Decode(v any) error
}

ResponseDecoder allows to specify custom JSON response decoder. By default, std json decoder is used.

type ResponseDecoderFunc

type ResponseDecoderFunc func(r io.Reader) ResponseDecoder

Jump to

Keyboard shortcuts

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