Documentation
¶
Index ¶
- Constants
- func AddEnabledFlag(cmd *cobra.Command)
- func AddListFlags(cmd *cobra.Command)
- func ConfirmDelete(stdout, stderr io.Writer, resource, id string, yes bool) error
- func GetListParams(cmd *cobra.Command) (page, pageSize int, filter, order, orderBy string)
- func ListParams(page, pageSize int, filter, order, orderBy string) map[string]string
- func MergeDataWithFlags(dataJSON string, cmd *cobra.Command, fieldMap map[string]string) (map[string]interface{}, error)
- func ParseJSON(s string) (interface{}, error)
- type AuthError
- type Runtime
- func (r *Runtime) LoadSession() (*session.Session, error)
- func (r *Runtime) NewClient(baseURL, token string) *api.Client
- func (r *Runtime) PrintJSON(v interface{})
- func (r *Runtime) PrintRaw(raw json.RawMessage)
- func (r *Runtime) RequireAuth() error
- func (r *Runtime) RequireURL() error
- func (r *Runtime) SyncSession() error
- type ValidationError
Constants ¶
const APIBase = "/api/v4.0"
Variables ¶
This section is empty.
Functions ¶
func AddEnabledFlag ¶
AddEnabledFlag adds --enabled flag accepting "yes" or "no".
func AddListFlags ¶
func ConfirmDelete ¶
ConfirmDelete asks for interactive confirmation before a destructive operation. In TTY mode without --yes, it prompts "Delete <resource> <id>? y/N". In non-TTY mode without --yes, it returns an error requiring --yes.
func GetListParams ¶
func ListParams ¶
func MergeDataWithFlags ¶
func MergeDataWithFlags(dataJSON string, cmd *cobra.Command, fieldMap map[string]string) (map[string]interface{}, error)
MergeDataWithFlags parses --data JSON, then overlays any explicitly set semantic flags (from fieldMap). Flags override data fields. fieldMap key = CLI flag name, value = API field name.
Types ¶
type AuthError ¶
type AuthError struct {
Message string
}
AuthError indicates missing or invalid authentication.
type Runtime ¶
type Runtime struct {
Session *session.Session
APIClient *api.Client
CredSource string // "token", "env", or "none"
Format output.Format
RawMode bool
HumanTime bool
DryRun bool
DefaultColumns []string // Per-command default columns for table output.
UserColumns []string // User-specified columns via --columns flag.
WideMode bool // Show all columns (--wide).
TermWidth int // Terminal width; 0 = unknown.
Stdout io.Writer
Stderr io.Writer
}
func (*Runtime) PrintJSON ¶
func (r *Runtime) PrintJSON(v interface{})
PrintJSON renders a Go value (map, struct) using the configured format.
func (*Runtime) PrintRaw ¶
func (r *Runtime) PrintRaw(raw json.RawMessage)
PrintRaw renders raw API JSON bytes using the configured format. In --raw mode, outputs pretty-printed full envelope.
func (*Runtime) RequireAuth ¶
func (*Runtime) RequireURL ¶
func (*Runtime) SyncSession ¶
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError indicates invalid user input (bad JSON, invalid flag values).
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string