params

package
v0.0.0-...-a161123 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamDescs = []check.ParameterDesc{
		requirementsTypeParamDesc,
		lowerBoundMBParamDesc,
		upperBoundMBParamDesc,
	}
)

Functions

func ParseAndValidate

func ParseAndValidate(m map[string]interface{}) (interface{}, error)

ParseAndValidate instantiates a Params object out of the passed map[string]interface{}, validates it, and returns it. The return type is interface{} to satisfy the type in the Template struct.

func WrapInstantiateFunc

func WrapInstantiateFunc(f func(p Params) (check.Func, error)) func(interface{}) (check.Func, error)

WrapInstantiateFunc is a convenience wrapper that wraps an untyped instantiate function into a typed one.

Types

type Params

type Params struct {

	// The type of requirement. Use any to apply to both requests and limits.
	// +enum=request
	// +enum=limit
	// +enum=any
	// +required
	RequirementsType string

	// The lower bound of the requirement (inclusive), specified as
	// a number of MB.
	LowerBoundMB int `json:"lowerBoundMB"`

	// The upper bound of the requirement (inclusive), specified as
	// a number of MB.
	// If not specified, it is treated as "no upper bound".
	UpperBoundMB *int `json:"upperBoundMB"`
}

Params represents the params accepted by this template.

func (*Params) Validate

func (p *Params) Validate() error

Jump to

Keyboard shortcuts

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