Documentation
¶
Index ¶
- Constants
- Variables
- func AttachExecSession(c *Client, selector, sessionID string) (int, error)
- func ConfigureCLI(c *Client, timeoutFlag string)
- func DialWS(c *Client, path string) (*websocket.Conn, error)
- func OperationIDFromStart(data map[string]any) string
- func ParseDurationFlag(raw string) (time.Duration, bool)
- func PollAsyncOperation(ctx context.Context, cfg PollConfig, fetch func() (map[string]any, error), ...) (map[string]any, []string, error)
- func PollTimeoutFor(kind string) time.Duration
- func StreamMSLogs(c *Client, id, tail, since, until string, timestamps bool) error
- func StreamSystemLogs(c *Client, tail, since, until string, timestamps bool) error
- type Client
- func (c *Client) IsDaemonRunning() bool
- func (c *Client) Request(method, path string, requestBody any) (map[string]any, error)
- func (c *Client) RequestMultipartFile(method, path, fileField, filePath string, fields map[string]string) (map[string]any, error)
- func (c *Client) SetRequestTimeout(timeout time.Duration)
- func (c *Client) Token() string
- type EdgeletAPI
- type EdgeletAPIError
- type PollConfig
- type PollError
- type PollProgress
Constants ¶
const ( // ErrCodeLocalAPIStarting is returned when the daemon is up but the unix API listener is not ready. ErrCodeLocalAPIStarting = "LOCAL_API_STARTING" ErrCodeDaemonUnavailable = "DAEMON_UNAVAILABLE" // ErrCodeControllerOffline is returned when the local API is up but the controller is unreachable. ErrCodeControllerOffline = "CONTROLLER_OFFLINE" )
const ( // DefaultRequestTimeout is the per-request HTTP budget when --timeout is unset. DefaultRequestTimeout = 60 * time.Second )
Variables ¶
var ErrPollTimeout = &PollError{Message: "operation polling timed out"}
ErrPollTimeout indicates polling exceeded the configured timeout.
Functions ¶
func AttachExecSession ¶
AttachExecSession attaches to an exec WebSocket session and streams stdin/stdout/stderr. Returns the remote command exit code when the session ends cleanly.
func ConfigureCLI ¶
ConfigureCLI applies CLI transport settings from the global --timeout flag. When set, --timeout overrides async poll totals only; per-request HTTP stays at DefaultRequestTimeout.
func DialWS ¶
DialWS opens a EdgeletAPI WebSocket using the same auth/dial behavior as the legacy CLI.
func OperationIDFromStart ¶
OperationIDFromStart extracts an async operation id from a start response.
func ParseDurationFlag ¶
ParseDurationFlag parses a Go duration string from the CLI --timeout flag.
func PollAsyncOperation ¶
func PollAsyncOperation(ctx context.Context, cfg PollConfig, fetch func() (map[string]any, error), progress PollProgress) (map[string]any, []string, error)
PollAsyncOperation polls fetch until the operation reaches a terminal status. When StageFormatter is set, stage transitions are rendered on stderr. When PercentLabel is set, percent progress is rendered instead.
func PollTimeoutFor ¶
PollTimeoutFor returns the poll budget for an operation class, honoring --timeout when set.
func StreamMSLogs ¶
StreamMSLogs follows microservice logs over WebSocket.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for communicating with the Edgelet API
func (*Client) IsDaemonRunning ¶
IsDaemonRunning checks if the daemon is running First checks PID file, then tries Edgelet API connection
func (*Client) Request ¶
Request sends a typed request to EdgeletAPI v1 and returns JSON response map when possible.
func (*Client) RequestMultipartFile ¶
func (c *Client) RequestMultipartFile(method, path, fileField, filePath string, fields map[string]string) (map[string]any, error)
RequestMultipartFile uploads a multipart manifest file with optional fields.
func (*Client) SetRequestTimeout ¶
SetRequestTimeout configures the per-request HTTP timeout for unix/TLS transports.
type EdgeletAPI ¶
type EdgeletAPI interface {
Request(method, path string, requestBody any) (map[string]any, error)
RequestMultipartFile(method, path, fileField, filePath string, fields map[string]string) (map[string]any, error)
IsDaemonRunning() bool
}
EdgeletAPI is the EdgeletAPI v1 surface used by CLI client helpers.
type EdgeletAPIError ¶
EdgeletAPIError is a structured EdgeletAPI v1 error.
func (*EdgeletAPIError) Error ¶
func (e *EdgeletAPIError) Error() string
type PollConfig ¶
PollConfig controls async operation polling.