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 ¶
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.
Click to show internal directories.
Click to hide internal directories.