tableclient

package
v2.11.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTableRoundTripper

func NewTableRoundTripper(parent http.RoundTripper) http.RoundTripper

NewTableRoundTripper creates a RoundTripper that requests resource lists as tables from the Kubernetes API server. See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for more information.

Example
rt := NewTableRoundTripper(&MockRoundTripper{})
req, err := http.NewRequest(http.MethodGet, "master.svc.cluster.local", nil)
if err != nil {
	panic(err)
}
rt.RoundTrip(req)
Output:

URL: master.svc.cluster.local
Accepts: application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json

Types

type Interface

type Interface interface {
	Table(ctx context.Context, typ Type, namespace string, opts metav1.ListOptions) (*metav1beta1.Table, error)
}

Interface contains the public definitions for table clients.

func New

func New(config *rest.Config) (Interface, error)

New creates a table client given a RestConfig. The config WILL BE MODIFIED.

Example
client, err := New(&rest.Config{
	Transport: &MockRoundTripper{},
})
if err != nil {
	panic(err)
}

// This example won't hit a real endpoint, but the mock will show that the URL
// and selector work for getting namespaced tables.
client.Table(context.Background(), MockType{}, "demo", metav1.ListOptions{})
Output:

URL: http://localhost/apis/test.group/v1/namespaces/demo/tests
Accepts: application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json

type Type

type Type interface {
	// Namespaced returns whether the resource is namespace-scoped.
	Namespaced() bool
	// GroupVersionResource returns the GVR of the target resource.
	GroupVersionResource(ctx context.Context) schema.GroupVersionResource
}

Type contains type information for the table client.

Directories

Path Synopsis
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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