// Validate validates the ConsensusParams to ensure all values are within their
// allowed limits, and returns an error if they are not.
972248
func (params *ConsensusParams) Validate() error {
	if params.Block.MaxBytes <= 0 {
		return cmn.NewError("Block.MaxBytes must be greater than 0. Got %d",
			params.Block.MaxBytes)
	}
	if params.Block.MaxBytes > MaxBlockSizeBytes {
		return cmn.NewError("Block.MaxBytes is too big. %d > %d",
			params.Block.MaxBytes, MaxBlockSizeBytes)
	}

	if params.Block.MaxGas < -1 {
		return cmn.NewError("Block.MaxGas must be greater or equal to -1. Got %d",
			params.Block.MaxGas)
	}

	if params.Block.TimeIotaMs <= 0 {
		return cmn.NewError("Block.TimeIotaMs must be greater than 0. Got %v",
			params.Block.TimeIotaMs)
	}

	if params.Evidence.MaxAge <= 0 {
		return cmn.NewError("EvidenceParams.MaxAge must be greater than 0. Got %d",
			params.Evidence.MaxAge)
	}

	if len(params.Validator.PubKeyTypes) == 0 {
		return cmn.NewError("len(Validator.PubKeyTypes) must be greater than 0")
	}

	// Check if keyType is a known ABCIPubKeyType
	for i := 0; i < len(params.Validator.PubKeyTypes); i++ {
		keyType := params.Validator.PubKeyTypes[i]
		if _, ok := ABCIPubKeyTypesToAminoNames[keyType]; !ok {
			return cmn.NewError("params.Validator.PubKeyTypes[%d], %s, is an unknown pubkey type",
				i, keyType)
		}
	}

	return nil
}
973183
func (vc ValidChain) Validate(s string) error {
	for _, v := range vc {
		if e := v(s); e != nil {
			return e
		}
	}

	return nil
}
20985
func (v *GranteeType) Validate() error {

	if v.Type == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Type",
			ParentName:    "Grantee",
		}
	}

	if v.Type != nil {
		typeValidValues := []string{"user", "group"}
		typeParameterValue := fmt.Sprint(*v.Type)

		typeIsValid := false
		for _, value := range typeValidValues {
			if value == typeParameterValue {
				typeIsValid = true
			}
		}

		if !typeIsValid {
			return errors.ParameterValueNotAllowedError{
				ParameterName:  "Type",
				ParameterValue: typeParameterValue,
				AllowedValues:  typeValidValues,
			}
		}
	}

	return nil
}
151271
func (o *Options) Validate() error {
	if o.Output != "" && o.Output != "yaml" && o.Output != "json" {
		return errors.New(`--output must be 'yaml' or 'json'`)
	}

	return nil
}
16792
func (v *ACLType) Validate() error {

	if v.Grantee != nil {
		if err := v.Grantee.Validate(); err != nil {
			return err
		}
	}

	if v.Grantee == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Grantee",
			ParentName:    "ACL",
		}
	}

	if v.Permission == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Permission",
			ParentName:    "ACL",
		}
	}

	if v.Permission != nil {
		permissionValidValues := []string{"READ", "WRITE", "FULL_CONTROL"}
		permissionParameterValue := fmt.Sprint(*v.Permission)

		permissionIsValid := false
		for _, value := range permissionValidValues {
			if value == permissionParameterValue {
				permissionIsValid = true
			}
		}

		if !permissionIsValid {
			return errors.ParameterValueNotAllowedError{
				ParameterName:  "Permission",
				ParameterValue: permissionParameterValue,
				AllowedValues:  permissionValidValues,
			}
		}
	}

	return nil
}
576878
func (payload *rateBottlePayload) Validate() (err error) {
	if payload.Rating == nil {
		err = goa.MergeErrors(err, goa.MissingAttributeError(`raw`, "rating"))
	}
	if payload.Rating != nil {
		if *payload.Rating < 1 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`raw.rating`, *payload.Rating, 1, true))
		}
	}
	if payload.Rating != nil {
		if *payload.Rating > 5 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`raw.rating`, *payload.Rating, 5, false))
		}
	}
	return
}
39540
func (config ManifoldConfig) Validate() error {
	if config.AgentName == "" {
		return errors.NotValidf("empty AgentName")
	}
	if config.APICallerName == "" {
		return errors.NotValidf("empty APICallerName")
	}
	if config.BrokerName == "" {
		return errors.NotValidf("empty BrokerName")
	}
	if config.ClockName == "" {
		return errors.NotValidf("empty ClockName")
	}
	if config.NewWorker == nil {
		return errors.NotValidf("nil NewWorker")
	}
	return nil
}
958529
func (s *GetTemplateService) Validate() error {
	var invalid []string
	if s.id == "" {
		invalid = append(invalid, "Id")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
993062
func (c *EnumConstraint) Validate(v interface{}) (err error) {
	if pdebug.Enabled {
		g := pdebug.Marker("EnumConstraint.Validate (%s)", v).BindError(&err)
		defer g.End()
	}
	for _, e := range c.enums {
		if e == v {
			return nil
		}
	}
	return errors.New("value is not in enumeration")
}
808333
func (p *MintParams) Validate() error {
	// Check FDQN.
	fqdn, err := p.MachineFQDN()
	if err != nil {
		return err
	}
	chunks := strings.SplitN(fqdn, ".", 2)
	if len(chunks) != 2 {
		return fmt.Errorf("not a valid FQDN %q", fqdn)
	}
	domain := chunks[1] // e.g. "us-central1-a.c.project-id.internal"

	// Check DomainConfig for given domain.
	domainCfg := domainConfig(p.Config, domain)
	if domainCfg == nil {
		return fmt.Errorf("the domain %q is not whitelisted in the config", domain)
	}
	if domainCfg.MachineTokenLifetime <= 0 {
		return fmt.Errorf("machine tokens for machines in domain %q are not allowed", domain)
	}

	// Make sure cert serial number fits into uint64. We don't support negative or
	// giant SNs.
	sn := p.Cert.SerialNumber
	if sn.Sign() <= 0 || sn.Cmp(maxUint64) >= 0 {
		return fmt.Errorf("invalid certificate serial number: %s", sn)
	}
	return nil
}
232583
func (m *QueryParameterMatcher) Validate() error {
	if m == nil {
		return nil
	}

	if l := len(m.GetName()); l < 1 || l > 1024 {
		return QueryParameterMatcherValidationError{
			field:  "Name",
			reason: "value length must be between 1 and 1024 bytes, inclusive",
		}
	}

	// no validation rules for Value

	{
		tmp := m.GetRegex()

		if v, ok := interface{}(tmp).(interface{ Validate() error }); ok {

			if err := v.Validate(); err != nil {
				return QueryParameterMatcherValidationError{
					field:  "Regex",
					reason: "embedded message failed validation",
					cause:  err,
				}
			}
		}
	}

	return nil
}
638746
func (e *Error) Validate(r *http.Request, response bool) *Error {

	switch {
	case e.Status == 0:
		return ISE(fmt.Sprintf("No HTTP Status set for error %+v\n", e))
	case e.Status < 400 || e.Status > 600:
		return ISE(fmt.Sprintf("HTTP Status out of valid range for error %+v\n", e))
	case e.Status == 422 && e.Source.Pointer == "":
		return ISE(fmt.Sprintf("Source Pointer must be set for 422 Status error"))
	}

	return nil
}
274143
func (a *AMQPArgs) Validate() error {
	if !a.Enable {
		return nil
	}
	if _, err := amqp.ParseURI(a.URL.String()); err != nil {
		return err
	}
	return nil
}
249372
func (ut *bottlePayload) Validate() (err error) {
	if ut.Color != nil {
		if !(*ut.Color == "red" || *ut.Color == "white" || *ut.Color == "rose" || *ut.Color == "yellow" || *ut.Color == "sparkling") {
			err = goa.MergeErrors(err, goa.InvalidEnumValueError(`request.color`, *ut.Color, []interface{}{"red", "white", "rose", "yellow", "sparkling"}))
		}
	}
	if ut.Country != nil {
		if utf8.RuneCountInString(*ut.Country) < 2 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.country`, *ut.Country, utf8.RuneCountInString(*ut.Country), 2, true))
		}
	}
	if ut.Name != nil {
		if utf8.RuneCountInString(*ut.Name) < 2 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 2, true))
		}
	}
	if ut.Review != nil {
		if utf8.RuneCountInString(*ut.Review) < 3 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.review`, *ut.Review, utf8.RuneCountInString(*ut.Review), 3, true))
		}
	}
	if ut.Review != nil {
		if utf8.RuneCountInString(*ut.Review) > 300 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.review`, *ut.Review, utf8.RuneCountInString(*ut.Review), 300, false))
		}
	}
	if ut.Sweetness != nil {
		if *ut.Sweetness < 1 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`request.sweetness`, *ut.Sweetness, 1, true))
		}
	}
	if ut.Sweetness != nil {
		if *ut.Sweetness > 5 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`request.sweetness`, *ut.Sweetness, 5, false))
		}
	}
	if ut.Varietal != nil {
		if utf8.RuneCountInString(*ut.Varietal) < 4 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.varietal`, *ut.Varietal, utf8.RuneCountInString(*ut.Varietal), 4, true))
		}
	}
	if ut.Vineyard != nil {
		if utf8.RuneCountInString(*ut.Vineyard) < 2 {
			err = goa.MergeErrors(err, goa.InvalidLengthError(`request.vineyard`, *ut.Vineyard, utf8.RuneCountInString(*ut.Vineyard), 2, true))
		}
	}
	if ut.Vintage != nil {
		if *ut.Vintage < 1900 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`request.vintage`, *ut.Vintage, 1900, true))
		}
	}
	if ut.Vintage != nil {
		if *ut.Vintage > 2020 {
			err = goa.MergeErrors(err, goa.InvalidRangeError(`request.vintage`, *ut.Vintage, 2020, false))
		}
	}
	return
}
722552
func (s *ScalingConstraints) Validate() error {
	invalidParams := request.ErrInvalidParams{Context: "ScalingConstraints"}
	if s.MaxCapacity == nil {
		invalidParams.Add(request.NewErrParamRequired("MaxCapacity"))
	}
	if s.MinCapacity == nil {
		invalidParams.Add(request.NewErrParamRequired("MinCapacity"))
	}

	if invalidParams.Len() > 0 {
		return invalidParams
	}
	return nil
}
983045
func (o *Options) Validate(args []string) error {
	if len(args) != 0 {
		return errors.New("no arguments are supported")
	}
	if errs := validation.Validate(o.config); len(errs) != 0 {
		return errs.ToAggregate()
	}

	return nil
}
1059662
func (c *Config) Validate() error {
	for format := range c.Overrides {
		if _, err := Get(format); err != nil {
			return err
		}
	}
	return nil
}