// Validate returns an error if r is invalid.
160985
func (r *ArchiveRequest) Validate() error {
	switch {
	case r.Format == ArchiveRequest_Invalid:
		return errors.New("format must be valid")
	case r.Project == "":
		return errors.New("project is required")
	case r.Ref == "":
		return errors.New("ref is required")
	default:
		return nil
	}
}
21928
func (m *DoubleMatcher) Validate() error {
	if m == nil {
		return nil
	}

	switch m.MatchPattern.(type) {

	case *DoubleMatcher_Range:

		{
			tmp := m.GetRange()

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

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

	case *DoubleMatcher_Exact:
		// no validation rules for Exact

	default:
		return DoubleMatcherValidationError{
			field:  "MatchPattern",
			reason: "value is required",
		}

	}

	return nil
}
703251
func (r RedisArgs) Validate() error {
	if !r.Enable {
		return nil
	}

	if r.Format != "" {
		f := strings.ToLower(r.Format)
		if f != event.NamespaceFormat && f != event.AccessFormat {
			return fmt.Errorf("unrecognized format")
		}
	}

	if r.Key == "" {
		return fmt.Errorf("empty key")
	}

	return nil
}
1106738
func (bc *BooleanConstraint) Validate(v interface{}) error {
	rv := reflect.ValueOf(v)
	switch rv.Kind() {
	case reflect.Bool:
	default:
		return errors.New("value is not a boolean")
	}
	return nil
}
182811
func (val *Validation) Validate(checkers ...Checker) *Validation {

	for _, checker := range checkers {
		if pass, msg := checker(); !pass {
			if val == nil {
				val = &Validation{}
			}

			val.Errors = append(val.Errors, msg)
		}
	}

	return val
}
1274993
func (argv *argT) Validate(ctx *cli.Context) error {
	if argv.Age < 0 || argv.Age > 300 {
		return fmt.Errorf("age %d out of range", argv.Age)
	}
	if argv.Gender != "male" && argv.Gender != "female" {
		return fmt.Errorf("invalid gender %s", ctx.Color().Yellow(argv.Gender))
	}
	return nil
}
1111145
func (v *Validator) Validate(x interface{}) error {
	jsv, err := v.validator()
	if err != nil {
		return err
	}
	return jsv.Validate(x)
}
176890
func (t *Terraform) Validate() []error {
	var errs []error

	if raw := t.RequiredVersion; raw != "" {
		// Check that the value has no interpolations
		rc, err := NewRawConfig(map[string]interface{}{
			"root": raw,
		})
		if err != nil {
			errs = append(errs, fmt.Errorf(
				"terraform.required_version: %s", err))
		} else if len(rc.Interpolations) > 0 {
			errs = append(errs, fmt.Errorf(
				"terraform.required_version: cannot contain interpolations"))
		} else {
			// Check it is valid
			_, err := version.NewConstraint(raw)
			if err != nil {
				errs = append(errs, fmt.Errorf(
					"terraform.required_version: invalid syntax: %s", err))
			}
		}
	}

	if t.Backend != nil {
		errs = append(errs, t.Backend.Validate()...)
	}

	return errs
}
1136519
func (ctx *ValidationContext) Validate(el *etree.Element) (*etree.Element, error) {
	// Make a copy of the element to avoid mutating the one we were passed.
	el = el.Copy()

	sig, err := ctx.findSignature(el)
	if err != nil {
		return nil, err
	}

	cert, err := ctx.verifyCertificate(sig)
	if err != nil {
		return nil, err
	}

	return ctx.validateSignature(el, sig, cert)
}
849694
func (i *I) Validate(ctx *Context) error {
	_, err := i.template(ctx)
	return err
}
70328
func (m *Body) Validate() error {
	if m == nil {
		return nil
	}

	// no validation rules for Truncated

	switch m.BodyType.(type) {

	case *Body_AsBytes:
		// no validation rules for AsBytes

	case *Body_AsString:
		// no validation rules for AsString

	}

	return nil
}
1369155
func (s *X509Signer) Validate() error {
	s.init.Do(func() {
		s.err = s.initialize()
	})
	return s.err
}
1043783
func (v *StringRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if isNil || IsEmpty(value) {
		return nil
	}

	str, err := EnsureString(value)
	if err != nil {
		return err
	}

	if v.validate(str) {
		return nil
	}
	return errors.New(v.message)
}
73216
func (v Value) Validate() error {
	switch v {
	case Alive, Dying, Dead:
		return nil
	}
	return errors.NotValidf("life value %q", v)
}
665481
func (grant *Grant) Validate() error {
	g := string(*grant)
	if len(g) > grantMaxLen {
		return ErrGrantTooLarge
	}
	if len(g) < grantMinLen {
		return ErrGrantTooSmall
	}

	if grantRegex.MatchString(g) {
		return nil
	}
	return ErrInvalidGrantCharacter
}
319457
func (s *Source) Validate() error {
	if s.Source == "" {
		return errors.New(ErrValidation, errorMessages, "item source must not be empty")
	}
	if _, err := url.Parse(s.URL); err != nil {
		return errors.Annotate(err, ErrParsing, errorMessages, "item source URL")
	}
	return nil
}
498878
func (v *OptionsObjectInput) Validate() error {

	if v.AccessControlRequestMethod == nil {
		return errors.ParameterRequiredError{
			ParameterName: "AccessControlRequestMethod",
			ParentName:    "OptionsObjectInput",
		}
	}

	if v.Origin == nil {
		return errors.ParameterRequiredError{
			ParameterName: "Origin",
			ParentName:    "OptionsObjectInput",
		}
	}

	return nil
}