Documentation
¶
Index ¶
- func ApplyFieldResolution(data []formatter.GenericTableData, enableResolve bool) error
- func ContainsHelp(args []string) bool
- func FormatNestedValue(value interface{}) string
- func GetCacheAccessor() (*vendors.CacheAccessor, error)
- func GetNestedValue(data map[string]interface{}, path string) (interface{}, bool)
- func IsMAC(s string) bool
- func NewCacheTableAccessor() (formatter.CacheAccessor, error)
- func NormalizeDeviceType(deviceType string) string
- func ValidateDeviceType(deviceType string) error
- func ValidateInventoryArgs(_ *cobra.Command, args []string) error
- func ValidateShowAPArgs(_ *cobra.Command, args []string) error
- type CacheTableAccessor
- func (c *CacheTableAccessor) GetCachedData(index string) (map[string]interface{}, bool)
- func (c *CacheTableAccessor) GetFieldByPath(data map[string]interface{}, path string) (interface{}, bool)
- func (c *CacheTableAccessor) GetSiteName(siteID string) (string, bool)
- func (c *CacheTableAccessor) ResolveID(fieldName string, id string) (string, bool)
- type ParsedApplyArgs
- type ParsedShowArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFieldResolution ¶
func ApplyFieldResolution(data []formatter.GenericTableData, enableResolve bool) error
ApplyFieldResolution applies field resolution to table data in-place This should be called once during data preparation, not in individual formatters
func ContainsHelp ¶
ContainsHelp checks if "help" is present in the arguments
func FormatNestedValue ¶
func FormatNestedValue(value interface{}) string
FormatNestedValue formats a nested value for display. Handles special cases like arrays, maps, and nil values.
func GetCacheAccessor ¶
func GetCacheAccessor() (*vendors.CacheAccessor, error)
GetCacheAccessor returns the cache accessor for commands (delegates to vendors package singleton)
func GetNestedValue ¶
GetNestedValue retrieves a value from a nested map using dot-separated path. Supports paths like "radio_config.band_5.channel" or "ip_config.vlan_id".
func NewCacheTableAccessor ¶
func NewCacheTableAccessor() (formatter.CacheAccessor, error)
NewCacheTableAccessor creates a table-compatible cache accessor
func NormalizeDeviceType ¶
NormalizeDeviceType converts device type aliases to canonical form
func ValidateDeviceType ¶
ValidateDeviceType validates that the device type is supported
func ValidateInventoryArgs ¶
ValidateInventoryArgs validates arguments for the show inventory command
Types ¶
type CacheTableAccessor ¶
type CacheTableAccessor struct {
// contains filtered or unexported fields
}
CacheTableAccessor implements formatter.CacheAccessor for table formatting It provides access to full device config data and supports nested field lookups.
func (*CacheTableAccessor) GetCachedData ¶
func (c *CacheTableAccessor) GetCachedData(index string) (map[string]interface{}, bool)
GetCachedData retrieves full cached config data by MAC address. This returns the complete device configuration including all vendor-specific fields.
func (*CacheTableAccessor) GetFieldByPath ¶
func (c *CacheTableAccessor) GetFieldByPath(data map[string]interface{}, path string) (interface{}, bool)
GetFieldByPath retrieves a nested field value by dot-separated path. This supports paths like "radio_config.band_5.channel" or "ip_config.vlan_id".
func (*CacheTableAccessor) GetSiteName ¶
func (c *CacheTableAccessor) GetSiteName(siteID string) (string, bool)
GetSiteName provides site name lookup capability
type ParsedApplyArgs ¶
type ParsedApplyArgs struct {
SiteName string
Operation string
DeviceType string
ExtraArgs []string
}
ParsedApplyArgs represents parsed arguments for apply commands
func ParseApplyArgs ¶
func ParseApplyArgs(args []string) (*ParsedApplyArgs, error)
ParseApplyArgs parses positional arguments for apply commands Supports pattern: <site-name> <operation> [extra-args...]
type ParsedShowArgs ¶
type ParsedShowArgs struct {
Filter string
SiteName string
Target string // API target label (e.g., "mist-prod", "meraki")
Format string
ShowAll bool
NoResolve bool
DeviceType string
}
ParsedShowArgs represents parsed arguments for show commands
func ParseShowArgs ¶
func ParseShowArgs(args []string) (*ParsedShowArgs, error)
ParseShowArgs parses positional arguments for show commands Supports patterns like: [name-or-mac] [site site-name] [target api-label] [json|csv] [all] [no-resolve]