client

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package client provides a high-performance, typed Go client SDK for Tarak clusters.

Example usage:

c, err := client.NewClientFromKubeconfig("~/.tarak/config")
if err != nil {
    log.Fatal(err)
}

pods, err := c.Pods("default").List(context.Background())
for _, p := range pods {
    fmt.Printf("Pod: %s (Phase: %s)\n", p.Name, p.Phase)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the primary entry point for interacting with the Tarak API server.

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

NewClient creates a new Tarak API client from programmatic options.

func NewClientFromKubeconfig

func NewClientFromKubeconfig(kubeconfigPath string) (*Client, error)

NewClientFromKubeconfig creates a Tarak client by parsing a kubeconfig file.

func (*Client) Ingresses

func (c *Client) Ingresses(namespace string) IngressesInterface

Ingresses returns an IngressesInterface for the given namespace.

func (*Client) Namespaces

func (c *Client) Namespaces() NamespacesInterface

Namespaces returns the NamespacesInterface.

func (*Client) Pods

func (c *Client) Pods(namespace string) PodsInterface

Pods returns a PodsInterface for the given namespace.

func (*Client) ServerURL

func (c *Client) ServerURL() string

ServerURL returns the connected API server base URL.

func (*Client) Tunnels

func (c *Client) Tunnels() TunnelsInterface

Tunnels returns a TunnelsInterface for inspecting Cloudflare and Tailscale tunnels.

type ClientOptions

type ClientOptions struct {
	ServerURL string
	CAData    []byte
	CertData  []byte
	KeyData   []byte
	Token     string
	Insecure  bool
	Timeout   time.Duration
}

ClientOptions configures the client connection parameters.

type IngressesInterface

type IngressesInterface interface {
	List(ctx context.Context) ([]map[string]interface{}, error)
	Get(ctx context.Context, name string) (map[string]interface{}, error)
	Create(ctx context.Context, obj map[string]interface{}) (map[string]interface{}, error)
	Delete(ctx context.Context, name string) error
}

IngressesInterface exposes Ingress operations for a namespace.

type NamespacesInterface

type NamespacesInterface interface {
	List(ctx context.Context) ([]string, error)
	Create(ctx context.Context, name string) error
	Delete(ctx context.Context, name string) error
}

NamespacesInterface provides namespace management.

type Pod

type Pod struct {
	Name      string            `json:"name"`
	Namespace string            `json:"namespace"`
	Phase     string            `json:"phase"`
	IP        string            `json:"ip"`
	Node      string            `json:"node"`
	Labels    map[string]string `json:"labels"`
}

Pod represents a simplified typed pod object.

type PodsInterface

type PodsInterface interface {
	List(ctx context.Context) ([]Pod, error)
	Get(ctx context.Context, name string) (map[string]interface{}, error)
	Create(ctx context.Context, obj map[string]interface{}) (map[string]interface{}, error)
	Delete(ctx context.Context, name string) error
}

PodsInterface exposes Pod CRUD operations for a namespace.

type TunnelInfo

type TunnelInfo struct {
	Type      string    `json:"type"`
	Active    bool      `json:"active"`
	PublicURL string    `json:"publicURL"`
	Mode      string    `json:"mode"`
	StartedAt time.Time `json:"startedAt"`
	LastError string    `json:"lastError,omitempty"`
}

TunnelInfo represents the live operational status of a tunnel.

type TunnelsInterface

type TunnelsInterface interface {
	List(ctx context.Context) ([]TunnelInfo, error)
}

TunnelsInterface exposes tunnel inspection operations.

Jump to

Keyboard shortcuts

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