client

package
v0.0.1-dev.12 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamespaceToProto

func NamespaceToProto(namespace *types.Namespace) *generated.Namespace

NamespaceToProto converts a domain namespace to a protobuf message.

func ProtoToNamespace

func ProtoToNamespace(proto *generated.Namespace) (*types.Namespace, error)

ProtoToNamespace converts a protobuf message to a domain namespace.

func ProtoToService

func ProtoToService(proto *generated.Service) (*types.Service, error)

func ServiceToProto

func ServiceToProto(service *types.Service) *generated.Service

Helper functions for converting between types.Service and generated.Service serviceToProto converts a types.Service to a generated.Service proto message.

Types

type Client

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

Client provides a client for interacting with the Rune API server.

func NewClient

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

NewClient creates a new API client with the given options.

func (*Client) Close

func (c *Client) Close() error

Close closes the client connection.

func (*Client) Conn

func (c *Client) Conn() *grpc.ClientConn

Conn exposes the underlying gRPC connection for generated clients

func (*Client) Context

func (c *Client) Context() (context.Context, context.CancelFunc)

Context returns a context with the configured call timeout.

type ClientOptions

type ClientOptions struct {
	// Address of the API server
	Address string

	// TLS configuration
	UseTLS      bool
	TLSCertFile string

	// Authentication (token-only)
	Token string

	// Timeouts
	DialTimeout time.Duration
	CallTimeout time.Duration

	// Logger
	Logger log.Logger
}

ClientOptions holds configuration options for the API client.

func DefaultClientOptions

func DefaultClientOptions() *ClientOptions

DefaultClientOptions returns the default client options.

type ConfigmapClient

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

ConfigmapClient provides methods for interacting with configs on the Rune API server.

func NewConfigmapClient

func NewConfigmapClient(client *Client) *ConfigmapClient

NewConfigmapClient creates a new configmap client.

func (*ConfigmapClient) CreateConfigmap

func (c *ConfigmapClient) CreateConfigmap(configmap *types.Configmap, ensureNamespace bool) error

CreateConfig creates a new configmap on the API server.

func (*ConfigmapClient) DeleteConfigmap

func (c *ConfigmapClient) DeleteConfigmap(namespace, name string) error

DeleteConfigmap deletes a configmap.

func (*ConfigmapClient) GetConfigmap

func (c *ConfigmapClient) GetConfigmap(namespace, name string) (*types.Configmap, error)

GetConfigmap retrieves a configmap by name.

func (*ConfigmapClient) GetLogger

func (c *ConfigmapClient) GetLogger() log.Logger

GetLogger returns the logger for this client

func (*ConfigmapClient) ListConfigmaps

func (c *ConfigmapClient) ListConfigmaps(namespace string, labelSelector string, fieldSelector string) ([]*types.Configmap, error)

ListConfigmaps lists configmaps in a namespace.

func (*ConfigmapClient) UpdateConfigmap

func (c *ConfigmapClient) UpdateConfigmap(configmap *types.Configmap) error

UpdateConfigmap updates an existing configmap.

type ExecClient

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

ExecClient provides methods for executing commands in instances.

func NewExecClient

func NewExecClient(client *Client) *ExecClient

NewExecClient creates a new exec client.

func (*ExecClient) NewExecSession

func (e *ExecClient) NewExecSession(ctx context.Context) (*ExecSession, error)

NewExecSession creates a new exec session.

type ExecOptions

type ExecOptions struct {
	Command        []string          // Command and arguments to execute
	Env            map[string]string // Environment variables to set
	WorkingDir     string            // Working directory for the command
	TTY            bool              // Whether to allocate a pseudo-TTY
	TerminalWidth  uint32            // Initial terminal width
	TerminalHeight uint32            // Initial terminal height
	Timeout        time.Duration     // Timeout for the exec session
}

ExecOptions defines the configuration for command execution.

type ExecSession

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

ExecSession represents an active exec session.

func (*ExecSession) Close

func (s *ExecSession) Close() error

Close closes the exec session.

func (*ExecSession) InitializeInstanceTarget

func (s *ExecSession) InitializeInstanceTarget(target string, namespace string, options *ExecOptions) error

InitializeInstanceTarget initializes the exec session with the given options.

func (*ExecSession) InitializeServiceTarget

func (s *ExecSession) InitializeServiceTarget(target string, namespace string, options *ExecOptions) error

InitializeServiceTarget initializes the exec session with the given options.

func (*ExecSession) RunInteractive

func (s *ExecSession) RunInteractive() error

RunInteractive runs an interactive exec session.

func (*ExecSession) RunNonInteractive

func (s *ExecSession) RunNonInteractive() error

RunNonInteractive runs a non-interactive exec session.

type HealthClient

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

HealthClient provides methods to query health info from the API server.

func NewHealthClient

func NewHealthClient(client *Client) *HealthClient

NewHealthClient creates a new health client.

func (*HealthClient) GetAPIServerCapacity

func (h *HealthClient) GetAPIServerCapacity() (float64, int64, error)

GetAPIServerCapacity returns server-cached single-node capacity (CPU cores, memory bytes). It queries the API server health with IncludeChecks and parses the capacity check.

func (*HealthClient) GetHealth

func (h *HealthClient) GetHealth(componentType, name, namespace string, includeChecks bool) (*generated.GetHealthResponse, error)

GetHealth queries health for a component type

type InstanceClient

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

InstanceClient provides methods for interacting with instances on the Rune API server.

func NewInstanceClient

func NewInstanceClient(client *Client) *InstanceClient

NewInstanceClient creates a new instance client.

func (*InstanceClient) GetInstance

func (i *InstanceClient) GetInstance(namespace, id string) (*types.Instance, error)

GetInstance retrieves an instance by ID.

func (*InstanceClient) ListInstances

func (i *InstanceClient) ListInstances(namespace, serviceID, labelSelector, fieldSelector string) ([]*types.Instance, error)

ListInstances lists instances in a namespace with optional filtering.

func (*InstanceClient) RestartInstance

func (i *InstanceClient) RestartInstance(namespace, id string, timeout time.Duration) error

RestartInstance restarts an instance.

func (*InstanceClient) StartInstance

func (i *InstanceClient) StartInstance(namespace, id string) error

StartInstance starts an instance.

func (*InstanceClient) StopInstance

func (i *InstanceClient) StopInstance(namespace, id string, timeout time.Duration) error

StopInstance stops an instance.

func (*InstanceClient) WatchInstances

func (i *InstanceClient) WatchInstances(namespace, serviceID, labelSelector, fieldSelector string) (<-chan InstanceWatchEvent, error)

WatchInstances watches instances for changes and returns a channel of events. Note: This simulates watch by polling the list endpoint, since we need to regenerate the protobuf code to include the new WatchInstances API.

type InstanceWatchEvent

type InstanceWatchEvent struct {
	Instance  *types.Instance
	EventType string // "ADDED", "MODIFIED", "DELETED"
	Error     error
}

InstanceWatchEvent represents an instance change event

type LogClient

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

LogClient provides methods for interacting with logs on the Rune API server.

func NewLogClient

func NewLogClient(client *Client) *LogClient

NewLogClient creates a new log client.

func (*LogClient) StreamLogs

StreamLogs creates a bidirectional stream for log streaming. This is a convenience method that wraps the underlying gRPC StreamLogs call.

type NamespaceClient

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

NamespaceClient provides methods for interacting with namespaces on the Rune API server.

func NewNamespaceClient

func NewNamespaceClient(client *Client) *NamespaceClient

NewNamespaceClient creates a new namespace client.

func (*NamespaceClient) CreateNamespace

func (n *NamespaceClient) CreateNamespace(namespace *types.Namespace) error

CreateNamespace creates a new namespace on the API server.

func (*NamespaceClient) DeleteNamespace

func (n *NamespaceClient) DeleteNamespace(name string, ignoreNotFound, force bool) error

DeleteNamespace deletes a namespace by name.

func (*NamespaceClient) GetLogger

func (n *NamespaceClient) GetLogger() log.Logger

GetLogger returns the logger for this client

func (*NamespaceClient) GetNamespace

func (n *NamespaceClient) GetNamespace(name string) (*types.Namespace, error)

GetNamespace retrieves a namespace by name.

func (*NamespaceClient) ListNamespaces

func (n *NamespaceClient) ListNamespaces(labelSelector, fieldSelector map[string]string) ([]*types.Namespace, error)

ListNamespaces lists all namespaces with optional filtering.

func (*NamespaceClient) WatchNamespaces

func (n *NamespaceClient) WatchNamespaces(labelSelector, fieldSelector map[string]string) (<-chan *types.Namespace, error)

WatchNamespaces watches for namespace changes.

type SecretClient

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

SecretClient provides methods for interacting with secrets on the Rune API server.

func NewSecretClient

func NewSecretClient(client *Client) *SecretClient

NewSecretClient creates a new secret client.

func (*SecretClient) CreateSecret

func (s *SecretClient) CreateSecret(secret *types.Secret, ensureNamespace bool) error

CreateSecret creates a new secret on the API server.

func (*SecretClient) DeleteSecret

func (s *SecretClient) DeleteSecret(namespace, name string) error

DeleteSecret deletes a secret.

func (*SecretClient) GetLogger

func (s *SecretClient) GetLogger() log.Logger

GetLogger returns the logger for this client

func (*SecretClient) GetSecret

func (s *SecretClient) GetSecret(namespace, name string) (*types.Secret, error)

GetSecret retrieves a secret by name.

func (*SecretClient) ListSecrets

func (s *SecretClient) ListSecrets(namespace string, labelSelector string, fieldSelector string) ([]*types.Secret, error)

ListSecrets lists secrets in a namespace.

func (*SecretClient) UpdateSecret

func (s *SecretClient) UpdateSecret(secret *types.Secret, force bool) error

UpdateSecret updates an existing secret.

type ServiceClient

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

ServiceClient provides methods for interacting with services on the Rune API server.

func NewServiceClient

func NewServiceClient(client *Client) *ServiceClient

NewServiceClient creates a new service client.

func (*ServiceClient) CreateService

func (s *ServiceClient) CreateService(service *types.Service, ensureNamespace bool) error

CreateService creates a new service on the API server.

func (*ServiceClient) DeleteService

func (s *ServiceClient) DeleteService(namespace, name string) error

DeleteService deletes a service by name.

func (*ServiceClient) DeleteServiceWithRequest

func (s *ServiceClient) DeleteServiceWithRequest(req *generated.DeleteServiceRequest) (*generated.DeleteServiceResponse, error)

DeleteServiceWithRequest deletes a service with the full request object.

func (*ServiceClient) GetDeletionStatus

func (s *ServiceClient) GetDeletionStatus(namespace, name string) (*generated.GetDeletionStatusResponse, error)

GetDeletionStatus gets the status of a deletion operation.

func (*ServiceClient) GetLogger

func (s *ServiceClient) GetLogger() log.Logger

GetLogger returns the logger for this client

func (*ServiceClient) GetService

func (s *ServiceClient) GetService(namespace, name string) (*types.Service, error)

GetService retrieves a service by name.

func (*ServiceClient) ListDeletionOperations

func (s *ServiceClient) ListDeletionOperations(namespace, status string) (*generated.ListDeletionOperationsResponse, error)

ListDeletionOperations lists all deletion operations.

func (*ServiceClient) ListInstances

ListInstances lists instances for a service.

func (*ServiceClient) ListServices

func (s *ServiceClient) ListServices(namespace string, labelSelector string, fieldSelector string) ([]*types.Service, error)

ListServices lists services in a namespace with optional filtering.

func (*ServiceClient) ScaleService

func (s *ServiceClient) ScaleService(namespace, name string, scale int) error

ScaleService changes the scale of a service.

func (*ServiceClient) ScaleServiceWithRequest

func (s *ServiceClient) ScaleServiceWithRequest(req *generated.ScaleServiceRequest) (*generated.ServiceResponse, error)

ScaleServiceWithRequest changes the scale of a service with the full request object.

func (*ServiceClient) UpdateService

func (s *ServiceClient) UpdateService(service *types.Service, force bool) error

UpdateService updates an existing service.

func (*ServiceClient) WatchScaling

func (s *ServiceClient) WatchScaling(namespace, name string, targetScale int) (<-chan *generated.ScalingStatusResponse, context.CancelFunc, error)

WatchScaling observes the scaling progress of a service and returns a channel of status updates. The caller should close the cancel function when done watching to prevent resource leaks.

func (*ServiceClient) WatchServices

func (s *ServiceClient) WatchServices(namespace string, labelSelector string, fieldSelector string) (<-chan WatchEvent, context.CancelFunc, error)

WatchServices watches services for changes and returns a channel of events. The caller should call the cancel function when done watching to prevent resource leaks.

type WatchEvent

type WatchEvent struct {
	Service   *types.Service
	EventType string // "ADDED", "MODIFIED", "DELETED"
	Error     error
}

WatchEvent represents a service change event

Jump to

Keyboard shortcuts

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