Documentation
¶
Index ¶
- Constants
- func FormatLocal(t time.Time) string
- func GetKernelClient(cmd *cobra.Command) kernel.Client
- func IsNotFound(err error) bool
- func NewClient(opts ...option.RequestOption) kernel.Client
- func Unzip(zipFilePath, destDir string) error
- func ZipDirectory(srcDir, destZip string) error
- type CleanedUpSdkError
- type ContextKey
Constants ¶
const DefaultTimeLayout = "2006-01-02 15:04:05 MST"
DefaultTimeLayout is the standard layout used for displaying timestamps. Includes the local timezone abbreviation to make it clear times are local.
Variables ¶
This section is empty.
Functions ¶
func FormatLocal ¶ added in v0.7.0
FormatLocal formats the provided time in the user's local timezone. If the time is zero, it returns "-".
func GetKernelClient ¶ added in v0.8.0
GetKernelClient retrieves the kernel client from the command context
func IsNotFound ¶ added in v0.7.0
IsNotFound returns true if the error is a Kernel API error with HTTP 404.
func NewClient ¶
func NewClient(opts ...option.RequestOption) kernel.Client
NewClient returns a kernel API client preconfigured with middleware that detects when a newer CLI/SDK version is required and informs the user.
It mirrors kernel.NewClient but injects an HTTP middleware that intercepts 400 responses with error codes "sdk_upgrade_required" or "sdk_update_required". When encountered, a helpful upgrade message is displayed once per process.
func ZipDirectory ¶
ZipDirectory compresses the given source directory into the destination file path.
Types ¶
type CleanedUpSdkError ¶
type CleanedUpSdkError struct {
Err error
}
CleanedUpSdkError extracts a message field from the raw JSON resposne. This is the convention we use in the API for error response bodies (400s and 500s)
func (CleanedUpSdkError) Error ¶
func (e CleanedUpSdkError) Error() string
func (CleanedUpSdkError) Unwrap ¶
func (e CleanedUpSdkError) Unwrap() error
type ContextKey ¶ added in v0.8.0
type ContextKey string
ContextKey is the type for context keys
const KernelClientKey ContextKey = "kernel_client"
KernelClientKey is the context key for the kernel client