// Validate ensures that the origin is correct.
186276
func (o Origin) Validate() error {
	if o.ControllerUUID == "" {
		return errors.NewNotValid(nil, "empty ControllerUUID")
	}
	if !names.IsValidModel(o.ControllerUUID) {
		return errors.NewNotValid(nil, fmt.Sprintf("ControllerUUID %q not a valid UUID", o.ControllerUUID))
	}

	if o.ModelUUID == "" {
		return errors.NewNotValid(nil, "empty ModelUUID")
	}
	if !names.IsValidModel(o.ModelUUID) {
		return errors.NewNotValid(nil, fmt.Sprintf("ModelUUID %q not a valid UUID", o.ModelUUID))
	}

	if err := o.Type.Validate(); err != nil {
		return errors.Annotate(err, "invalid Type")
	}

	if o.Name == "" && o.Type != OriginTypeUnknown {
		return errors.NewNotValid(nil, "empty Name")
	}
	if err := o.Type.ValidateName(o.Name); err != nil {
		return errors.Annotatef(err, "invalid Name %q", o.Name)
	}

	if !o.Software.isZero() {
		if err := o.Software.Validate(); err != nil {
			return errors.Annotate(err, "invalid Software")
		}
	}

	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
}
970472
func (a *Application) Validate(validator ApplicationValidator) *Application {
	a.validator = validator
	return a
}
127411
func (m *HttpStatus) Validate() error {
	if m == nil {
		return nil
	}

	if _, ok := StatusCode_name[int32(m.GetCode())]; !ok {
		return HttpStatusValidationError{
			field:  "Code",
			reason: "value must be one of the defined enum values",
		}
	}

	return nil
}
1187577
func (e Error) Validate(v interface{}) error {
	if e.Message == "" {
		return fmt.Errorf("invalid error message %q", e.Message)
	}

	if e.Code <= 0 {
		return fmt.Errorf("invalid error code %d", e.Code)
	}

	return nil
}
877010
func (c *Certificate) Validate() error {
	if len(c.CertPEM) == 0 {
		return errors.NotValidf("missing cert PEM")
	}
	if len(c.KeyPEM) == 0 {
		return errors.NotValidf("missing key PEM")
	}
	return nil
}
434912
func (c *GroupsRenameCall) Validate(validate bool) *GroupsRenameCall {
	c.validate = validate
	return c
}
1023391
func (c *cookie) Validate(ctx context.Context, r *http.Request) (Principal, error) {
	cookie, err := r.Cookie(c.Name)
	if err != nil {
		return Principal{}, ErrAuthentication
	}

	return c.Tokens.ValidPrincipal(ctx, Token(cookie.Value), c.Lifespan)
}
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
}
1072035
func (a Alphabet) Validate(s string) bool {
	t := s[:len(s)-1]
	c, err := a.Generate(t)
	if err != nil {
		return false
	}
	return rune(s[len(s)-1]) == c
}
670345
func (v *DefaultValidator) Validate(ctx context.Context, in interface{}) (interface{}, error) {
	if in == nil {
		return in, nil
	}

	v.lazyinit()
	if err := v.validate.Struct(in); err != nil {
		return nil, err
	}

	return in, nil
}
675006
func (t *EmpireTemplate) Validate() error {
	r := func(n string) error {
		return errors.New(fmt.Sprintf("%s is required", n))
	}

	if t.VpcId == "" {
		return r("VpcId")
	}
	if t.Cluster == "" {
		return r("Cluster")
	}
	if t.ServiceRole == "" {
		return r("ServiceRole")
	}
	if t.HostedZone == nil {
		return r("HostedZone")
	}
	if t.InternalSecurityGroupID == "" {
		return r("InternalSecurityGroupID")
	}
	if t.ExternalSecurityGroupID == "" {
		return r("ExternalSecurityGroupID")
	}
	if len(t.InternalSubnetIDs) == 0 {
		return r("InternalSubnetIDs")
	}
	if len(t.ExternalSubnetIDs) == 0 {
		return r("ExternalSubnetIDs")
	}
	if t.CustomResourcesTopic == "" {
		return r("CustomResourcesTopic")
	}

	return nil
}
1054761
func (c *CmdClause) Validate(validator CmdClauseValidator) *CmdClause {
	c.validator = validator
	return c
}
847097
func (i Ident) Validate() error {
	if err := i.Location.Validate(); err != nil {
		return errors.Wrap(err, "invalid location")
	}
	if err := ValidateNamed(i.Variant, false); err != nil {
		return errors.Wrap(err, "invalid variant")
	}
	return nil
}
218706
func (r *ResponseDefinition) Validate() *dslengine.ValidationErrors {
	verr := new(dslengine.ValidationErrors)
	if r.Headers != nil {
		verr.Merge(r.Headers.Validate("response headers", r))
	}
	if r.Status == 0 {
		verr.Add(r, "response status not defined")
	}
	return verr.AsError()
}
1250604
func (c *Cloud) Validate() error {
	if c.Domain == "" {
		return errors.New(ErrValidation, errorMessages, "cloud domain must not be empty")
	}
	if c.Path == "" || c.Path[0] != '/' {
		return errors.New(ErrValidation, errorMessages, "cloud path %q must not be empty and has to start with a slash", c.Path)
	}
	if c.Port < 1 || c.Port > 65535 {
		return errors.New(ErrValidation, errorMessages, "cloud port %d is out of range", c.Port)
	}
	return nil
}
96256
func (s *SnapshotGetService) Validate() error {
	var invalid []string
	if s.repository == "" {
		invalid = append(invalid, "Repository")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}