Documentation ¶
Index ¶
- func ConvertParamToActionBackend(parameter string) string
- func ConvertParamToNodeRunBackend(parameter string) string
- func FormatActionFilters(filters []string) (map[string][]string, error)
- func FormatNodeFilters(filters []string) (map[string][]string, error)
- func StringDateRangeToTime(date string) (time.Time, bool)
- func ValidSuggestionParam(field string) bool
- func ValidateDateRange(start string, end string) bool
- func ValidateMillsecondDateRange(start int64, end int64) (time.Time, time.Time, error)
- func ValidatePagingCursorTime(before int64, after int64, cursor string, end int64) (time.Time, bool, error)
- type SuggestionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertParamToActionBackend ¶
ConvertParamToActionBackend Transforms a parameter provided by consumers into a parameter that the 'backend' can understand.
func ConvertParamToNodeRunBackend ¶
ConvertParamToNodeRunBackend Transforms a parameter provided by consumers into a parameter that the 'backend' can understand.
We HAVE to use this function on every parameter query that we collect TODO: (@afiune) Delete me when we finish the migration since it now lives inside `proto/request/parameters.go`
func FormatActionFilters ¶
FormatActionFilters Will receive an array of filters and will format them into a map of strings To be used on filtering Actions.
Example:
[ "environment:adios", "environment:hola", "cookbook:awesome", "roles:lalala", ]
The returned filters would look like:
map[string][]string [
"environment": ["adios","hola"], "cookbook": ["awesome"], "roles": ["lalala"],
]
func FormatNodeFilters ¶
FormatNodeFilters Will receive an array of filters and will format them into a map of strings To be used on filtering Node Runs
Example:
[ "environment:adios", "environment:hola", "cookbook:awesome", "roles:lalala", ]
The returned filters would look like:
map[string][]string [
"environment": ["adios","hola"], "cookbook": ["awesome"], "roles": ["lalala"],
]
func StringDateRangeToTime ¶
StringDateRangeToTime will transform a Date Range (start/end) to a Time type it verifies that it has a specific layout
The format we want is: YYYY-MM-DD
func ValidSuggestionParam ¶
func ValidateDateRange ¶
ValidateDateRange will validate that the provided start & end date are valid. That means they both have to have the right format and the start time must be less than or equal to the end time
NOTE: If start or end are empty strings ("") that's consider an ok "empty" parameter
func ValidateMillsecondDateRange ¶
ValidateMillsecondDateRange will validate that the provided start & end date are valid. That means the start time must be less than or equal to the end time
NOTE: If start or end are 0 that's consider an ok "empty" parameter
Types ¶
type SuggestionType ¶
type SuggestionType int
const ( PlatformSug SuggestionType = iota NameSug EnvironmentSug PolicyGroupSug PolicyNameSug PolicyRevisionSug CookbooksSug RecipesSug ResourceNamesSug AttributesSug RolesSug ChefVersionSug ChefTagsSug )
Ended these constants with sug so that they do not get mixed up with other parameter validation constants