params

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertParamToActionBackend

func ConvertParamToActionBackend(parameter string) string

ConvertParamToActionBackend Transforms a parameter provided by consumers into a parameter that the 'backend' can understand.

func ConvertParamToNodeRunBackend

func ConvertParamToNodeRunBackend(parameter string) string

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

func FormatActionFilters(filters []string) (map[string][]string, error)

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

func FormatNodeFilters(filters []string) (map[string][]string, error)

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

func StringDateRangeToTime(date string) (time.Time, bool)

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 ValidSuggestionParam(field string) bool

func ValidateDateRange

func ValidateDateRange(start string, end string) bool

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

func ValidateMillsecondDateRange(start int64, end int64) (time.Time, time.Time, error)

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

func ValidatePagingCursorTime

func ValidatePagingCursorTime(before int64, after int64, cursor string, end int64) (time.Time, bool, error)

ValidatePagingCursorTime will validate the paging parameters

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

Jump to

Keyboard shortcuts

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