Documentation
¶
Index ¶
- func AssignValue(obj interface{}, jsonName string, value interface{})
- func BodyReader(response runtime.ClientResponse)
- func Exit(msg string, err error)
- func FormatISO8601(t time.Time) string
- func GetFieldValue(obj interface{}, jsonName string) reflect.Value
- func HumanizeAPIError(err error) string
- func ParseTimeRef(value string, now time.Time) (time.Time, error)
- func PrintError(err error)
- func Render(data []renderer.ResponseData)
- func RenderDetails(data []renderer.ResponseData)
- func RenderStatic(data []renderer.ResponseData)
- func Singular(str string) string
- func Str(s *string) string
- func TitleStr(str string) string
- func Untar(source, destination string) error
- func Unzip(source, destination string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignValue ¶
func AssignValue(obj interface{}, jsonName string, value interface{})
func BodyReader ¶
func BodyReader(response runtime.ClientResponse)
func FormatISO8601 ¶ added in v1.6.2
FormatISO8601 renders t the way the Latitude API expects filter timestamps: ISO 8601 seconds precision, UTC. The "Z" suffix is deliberately omitted — the events endpoint 500s when it is present.
func GetFieldValue ¶
func HumanizeAPIError ¶ added in v1.6.1
HumanizeAPIError rewrites generic SDK error strings into messages that tell the user what to do next. Falls back to err.Error() when nothing more specific is recognized.
Detection keys off the bracketed "[<status>]" status marker that the go-openapi runtime puts on its errors. Two shapes occur in practice:
[401] Unauthorized &{...} // generic response
[POST /servers][401] createServerUnauthorized ... // typed response
so the marker shows up either at the start of the string or right after the "[<method> <path>]" segment. Matching "[401]" only at those two anchors (start, or after a "]") catches both shapes while ignoring a bare "[401]" that merely appears inside an error payload. Matching loose words like "unauthorized" is avoided too — it would capture unrelated validation messages such as `"field 'role' has an unauthorized value"`.
func ParseTimeRef ¶ added in v1.6.2
ParseTimeRef resolves a user-supplied point in time. It accepts a relative duration looking back from now ("30m", "24h", "7d", "2w") or an absolute date/datetime ("2026-06-01", "2026-06-01T15:04:05", RFC3339).
func PrintError ¶
func PrintError(err error)
PrintError prints a formatted error. Recognized API failures are rewritten as actionable guidance for the user (e.g. 401 → "run lsh login").
func RenderDetails ¶ added in v1.7.0
func RenderDetails(data []renderer.ResponseData)
RenderDetails renders a single resource, opening the interactive details sheet directly — for `get` commands. Structured formats fall back to the regular renderer.
func RenderStatic ¶ added in v1.6.3
func RenderStatic(data []renderer.ResponseData)
RenderStatic renders without the interactive table — for flows like --wait where a full-screen takeover would interrupt progress output.
Types ¶
This section is empty.