Documentation
¶
Overview ¶
Package lib provides manually-maintained functionality that extends the auto-generated SDK.
Package lib provides manually-maintained functionality that extends the auto-generated SDK.
Package lib provides manually-maintained functionality that extends the auto-generated SDK.
Index ¶
- func CpFromInstance(ctx context.Context, cfg CpConfig, opts CpFromInstanceOptions) error
- func CpFromInstanceFromURL(ctx context.Context, baseURL, apiKey string, opts CpFromInstanceOptions) error
- func CpToInstance(ctx context.Context, cfg CpConfig, opts CpToInstanceOptions) error
- func CpToInstanceFromURL(ctx context.Context, baseURL, apiKey string, opts CpToInstanceOptions) error
- func Push(ctx context.Context, cfg PushConfig, sourceImage, targetName string) error
- func PushFromURL(ctx context.Context, baseURL, apiKey string, img v1.Image, targetName string) error
- func PushImage(ctx context.Context, cfg PushConfig, img v1.Image, targetName string) error
- type CpCallbacks
- type CpConfig
- type CpFromInstanceOptions
- type CpToInstanceOptions
- type DefaultDialer
- type PushConfig
- type WsConn
- type WsDialer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CpFromInstance ¶
func CpFromInstance(ctx context.Context, cfg CpConfig, opts CpFromInstanceOptions) error
CpFromInstance copies a file or directory from a running instance.
Example:
cfg, _ := lib.ExtractCpConfig(client.Options)
err := lib.CpFromInstance(ctx, cfg, lib.CpFromInstanceOptions{
InstanceID: "inst_123",
SrcPath: "/app/output.txt",
DstPath: "./local-output.txt",
})
func CpFromInstanceFromURL ¶
func CpFromInstanceFromURL(ctx context.Context, baseURL, apiKey string, opts CpFromInstanceOptions) error
CpFromInstanceFromURL is a convenience function that uses base URL and API key directly.
func CpToInstance ¶
func CpToInstance(ctx context.Context, cfg CpConfig, opts CpToInstanceOptions) error
CpToInstance copies a file or directory to a running instance.
Example:
cfg, _ := lib.ExtractCpConfig(client.Options)
err := lib.CpToInstance(ctx, cfg, lib.CpToInstanceOptions{
InstanceID: "inst_123",
SrcPath: "./local-file.txt",
DstPath: "/app/file.txt",
})
func CpToInstanceFromURL ¶
func CpToInstanceFromURL(ctx context.Context, baseURL, apiKey string, opts CpToInstanceOptions) error
CpToInstanceFromURL is a convenience function that uses base URL and API key directly.
func Push ¶
func Push(ctx context.Context, cfg PushConfig, sourceImage, targetName string) error
Push loads an image from the local Docker daemon and pushes it to hypeman's registry.
This is a convenience function for local development workflows where images are built using Docker. For CI/CD pipelines that use Kaniko, ko, or buildpacks, use PushImage directly with the v1.Image they produce.
Parameters:
- sourceImage: Local Docker image reference (e.g., "myapp:latest")
- targetName: Name in hypeman (defaults to sourceImage if empty)
func PushFromURL ¶
func PushFromURL(ctx context.Context, baseURL, apiKey string, img v1.Image, targetName string) error
PushFromURL is a convenience function that parses a base URL and API key directly, without needing a hypeman.Client. Useful for standalone scripts.
func PushImage ¶
PushImage pushes a v1.Image to hypeman's OCI registry.
This function works with images from any source supported by go-containerregistry:
- Images built with Kaniko, ko, or buildpacks (no Docker needed)
- Images pulled from remote registries via remote.Image()
- Images loaded from tarballs via tarball.ImageFromPath()
- Images from OCI layouts via layout.Image()
The targetName parameter specifies how the image will be named in hypeman (e.g., "myapp:latest" or "myorg/myapp:v1.0").
Types ¶
type CpCallbacks ¶
type CpCallbacks struct {
OnFileStart func(path string, size int64) // Called when a file starts copying
OnProgress func(bytesCopied int64) // Called as bytes are copied
OnFileEnd func(path string) // Called when a file finishes copying
}
CpCallbacks provides optional progress callbacks for copy operations.
type CpConfig ¶
type CpConfig struct {
// BaseURL is the base URL for the hypeman API
BaseURL string
// APIKey is the JWT token for authentication
APIKey string
}
CpConfig holds the configuration needed for copy operations. Extract this from a hypeman.Client using ExtractCpConfig.
func ExtractCpConfig ¶
func ExtractCpConfig(opts []requestconfig.RequestOption) (CpConfig, error)
ExtractCpConfig extracts the base URL and API key from client options.
type CpFromInstanceOptions ¶
type CpFromInstanceOptions struct {
InstanceID string // Instance ID to copy from
SrcPath string // Source path in guest
DstPath string // Local destination path
FollowLinks bool // Follow symbolic links
Archive bool // Preserve UID/GID ownership
Callbacks *CpCallbacks // Optional: progress callbacks
Dialer WsDialer // Optional: custom WebSocket dialer (for testing)
}
CpFromInstanceOptions configures a copy-from-instance operation
type CpToInstanceOptions ¶
type CpToInstanceOptions struct {
InstanceID string // Instance ID to copy to
SrcPath string // Local source path
DstPath string // Destination path in guest
Mode fs.FileMode // Optional: override file mode (0 = auto-detect)
Archive bool // Preserve UID/GID ownership
FollowLinks bool // Follow symbolic links when copying
Callbacks *CpCallbacks // Optional: progress callbacks
Dialer WsDialer // Optional: custom WebSocket dialer (for testing)
}
CpToInstanceOptions configures a copy-to-instance operation
type DefaultDialer ¶
type DefaultDialer struct{}
DefaultDialer uses gorilla/websocket for real WebSocket connections.
type PushConfig ¶
type PushConfig struct {
// RegistryHost is the host:port of the hypeman registry (derived from base URL)
RegistryHost string
// APIKey is the JWT token for authentication
APIKey string
}
PushConfig holds the configuration needed to push images to hypeman's registry. Extract this from a hypeman.Client using ExtractPushConfig.
func ExtractPushConfig ¶
func ExtractPushConfig(opts []requestconfig.RequestOption) (PushConfig, error)
ExtractPushConfig extracts the registry host and API key from client options. This is needed because the Client struct doesn't expose these values directly.