query

package
v6.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

This is used for getting query parameters from options in the CLI. And also for validate the parameters set - especially for filters.

Index

Constants

View Source
const FiltersPartitionChar = "="

Variables

This section is empty.

Functions

func GetListQueryParams

func GetListQueryParams(c *core.CommandConfig) (resources.ListQueryParams, error)

func ValidateFilters

func ValidateFilters(c *core.PreCommandConfig, availableFilters []string, usageFilters string) error

ValidateFilters is currently being used in PreRun to check if the user provided any invalid filters availableFilters is set by the caller to be the properties of the struct (e.g. Name, Description, etc) with the first letter non-caps, by using the SDK generated structs. usageFilters is the usage string printed to output if the usage is wrong

WARNING: It just so happens that we can find the `availableFilters` by using the SDK structs namings with non-caps first letter, but if the SDK struct fields naming were to change, then we would be forced to refactor the whole file commands/cloudapi/completer/filters.go

HACKY WORKAROUND WARNING: To work around the fact that we don't have access to availableFilters after this func's execution ends, and to keep support for 'any caps notation for properties is valid' rule e.g naME=myserver is a valid input, this func 'corrects' the caps of all keys that are valid. For example,

'--filters NAME=myserver,NAME=otherserver,imagetype=LINUX'

would be corrected to

'--filters name=myserver,name=otherserver,imageType=LINUX'

by MANUALLY setting the flag values, as well as the viper (global config) values.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL