takodclient

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONRequestTimeout   = 2 * time.Minute
	StreamRequestTimeout = 30 * time.Minute
)
View Source
const DefaultSocket = "/run/tako/takod.sock"

Variables

This section is empty.

Functions

func AccessLogsEndpoint

func AccessLogsEndpoint(tail int, follow bool) string

func ActualStateEndpoint

func ActualStateEndpoint(project string, environment string) string

func BackupsEndpoint

func BackupsEndpoint(project string, environment string, volume string, backupID string) string

func CertificatesEndpoint added in v0.9.2

func CertificatesEndpoint(domain string) string

func DiscoveryExportsEndpoint added in v0.4.35

func DiscoveryExportsEndpoint(environment string) string

func EnvBundleEndpoint

func EnvBundleEndpoint(project string, environment string) string

func ExecEndpoint added in v0.8.0

func ExecEndpoint() string

func ImageBuildEndpoint

func ImageBuildEndpoint(image string, dockerfile ...string) string

func ImageBuildEndpointWithAuth added in v0.8.0

func ImageBuildEndpointWithAuth(image string, dockerfile ...string) string

ImageBuildEndpointWithAuth marks the build request body as carrying a registry-auth JSON preamble line ahead of the tar stream. The flag is the only auth-related value in the URL; credentials ride the body.

func ImageBuildEndpointWithOptions

func ImageBuildEndpointWithOptions(image string, dockerfile string, withAuth bool) string

ImageBuildEndpointWithOptions marks the body as carrying a JSON options preamble before the build-context archive. Build arg values stay out of URLs.

func ImageExistsEndpoint added in v0.5.4

func ImageExistsEndpoint(image string) string

func JobsApplyEndpoint added in v0.8.0

func JobsApplyEndpoint() string

ExecEndpoint returns the takod exec endpoint path.

func LeaseEndpoint

func LeaseEndpoint(project string, environment string) string

func LogsEndpoint

func LogsEndpoint(project string, environment string, service string, tail int, follow bool) string

func MetricsEndpoint

func MetricsEndpoint(collect bool) string

func ProxyFileEndpoint

func ProxyFileEndpoint(name string) string

func RequestJSON

func RequestJSON(client RequestExecutor, socket string, method string, endpoint string, value any) (string, error)

func RequestJSONWithContext added in v0.7.0

func RequestJSONWithContext(ctx context.Context, client RequestExecutor, socket string, method string, endpoint string, value any) (string, error)

func RequestJSONWithTimeout added in v0.4.1

func RequestJSONWithTimeout(client RequestExecutor, socket string, method string, endpoint string, value any, timeout time.Duration) (string, error)

func RequestJSONWithTimeoutContext added in v0.7.0

func RequestJSONWithTimeoutContext(ctx context.Context, client RequestExecutor, socket string, method string, endpoint string, value any, timeout time.Duration) (string, error)

func RequireCapability added in v0.9.2

func RequireCapability(ctx context.Context, client RequestExecutor, socket string, server string, required string, feature string) error

RequireCapability reads /v1/status and fails closed before a caller sends a payload or invokes an endpoint an older node would silently ignore.

func StateEndpoint

func StateEndpoint(project string, environment string, document string) string

func StateNodeEndpoint

func StateNodeEndpoint(project string, environment string, document string, node string) string

func StateRevisionEndpoint

func StateRevisionEndpoint(project string, environment string, document string, revisionID string) string

func StatsEndpoint

func StatsEndpoint(project string, environment string, service string, all bool) string

func StreamOutput

func StreamOutput(client StreamExecutor, socket string, endpoint string, stdout io.Writer, stderr io.Writer) error

func StreamOutputWithContext added in v0.7.0

func StreamOutputWithContext(ctx context.Context, client StreamExecutor, socket string, endpoint string, stdout io.Writer, stderr io.Writer) error

func StreamRequest

func StreamRequest(client RequestExecutor, socket string, method string, endpoint string, reader io.Reader) (string, error)

func StreamRequestOutputWithContext added in v0.8.0

func StreamRequestOutputWithContext(ctx context.Context, client StreamExecutor, socket string, method string, endpoint string, body io.Reader, stdout io.Writer, stderr io.Writer) error

StreamRequestOutputWithContext sends a request body and streams the chunked response live to stdout/stderr (no buffering, no status marker) — the POST counterpart of StreamOutputWithContext. Clients without stdin streaming get the body embedded base64-encoded in the remote command.

func StreamRequestWithContext added in v0.7.0

func StreamRequestWithContext(ctx context.Context, client RequestExecutor, socket string, method string, endpoint string, reader io.Reader) (string, error)

Types

type CapabilityRequiredError added in v0.9.2

type CapabilityRequiredError struct {
	Server     string
	Capability string
	Feature    string
}

CapabilityRequiredError rejects an operation before mutation when a target node agent does not advertise a capability required by the request.

func (*CapabilityRequiredError) Error added in v0.9.2

func (e *CapabilityRequiredError) Error() string

type HTTPError added in v0.9.2

type HTTPError struct {
	Method   string
	Endpoint string
	Status   int
	Body     string
}

HTTPError preserves a non-success takod response status so command adapters can map rejected input to their typed machine error taxonomy.

func (*HTTPError) Error added in v0.9.2

func (e *HTTPError) Error() string

type RequestExecutor

type RequestExecutor interface {
	ExecuteWithContext(ctx context.Context, cmd string) (string, error)
	ExecuteWithInput(ctx context.Context, cmd string, input io.Reader) (string, error)
}

type StreamExecutor

type StreamExecutor interface {
	RequestExecutor
	ExecuteStream(cmd string, stdout io.Writer, stderr io.Writer) error
}

type UnixSocketDialer added in v0.8.1

type UnixSocketDialer interface {
	DialUnixSocket(ctx context.Context, path string) (net.Conn, error)
}

UnixSocketDialer opens a full-duplex connection to a Unix socket on the takod node, typically through an SSH direct-streamlocal channel.

type UpgradedStream added in v0.8.1

type UpgradedStream struct {
	Conn   net.Conn
	Reader *bufio.Reader
}

UpgradedStream is a hijacked takod connection speaking the ptystream frame protocol. Reader buffers bytes that arrived with the handshake response; always read frames from Reader, never from Conn directly.

func UpgradeStream added in v0.8.1

func UpgradeStream(ctx context.Context, dialer UnixSocketDialer, socket string, endpoint string, value any) (*UpgradedStream, error)

UpgradeStream dials the takod socket, POSTs value to endpoint with an Upgrade: tako-pty/1 handshake, and returns the connection as a raw frame stream once the server switches protocols. A non-101 response is returned as an error carrying the response body.

func (*UpgradedStream) Close added in v0.8.1

func (s *UpgradedStream) Close() error

Close closes the underlying connection.

Jump to

Keyboard shortcuts

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