params

package
v0.0.0-...-7cac148 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

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.

This is used for query of the node-state only for sorting and the converge-history index.

func ConvertParamToNodeStateBackendLowerFilter

func ConvertParamToNodeStateBackendLowerFilter(parameter string) string

ConvertParamToNodeStateBackendLowerFilter - The fields for the Elasticsearch mapping of node-state index. This is using the ".lower" values to match on fields case-insensitively

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 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 StringDateTimeRangeToTime

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

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 ValidateDateTimeRange

func ValidateDateTimeRange(start, end string) bool

ValidateDateTimeRange 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
	ErrorSug
	OrganizationSug
	ChefServerSug
)

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