// Validate validates the encoding MIME type and Go package path if set.
550344
func (enc *EncodingDefinition) Validate() *dslengine.ValidationErrors {
	verr := new(dslengine.ValidationErrors)
	if len(enc.MIMETypes) == 0 {
		verr.Add(enc, "missing MIME type")
		return verr
	}
	for _, m := range enc.MIMETypes {
		_, _, err := mime.ParseMediaType(m)
		if err != nil {
			verr.Add(enc, "invalid MIME type %#v: %s", m, err)
		}
	}
	if len(enc.PackagePath) > 0 {
		rel := filepath.FromSlash(enc.PackagePath)
		dir, err := os.Getwd()
		if err != nil {
			verr.Add(enc, "couldn't retrieve working directory %s", err)
			return verr
		}
		_, err = build.Default.Import(rel, dir, build.FindOnly)
		if err != nil {
			verr.Add(enc, "invalid Go package path %#v: %s", enc.PackagePath, err)
			return verr
		}
	} else {
		for _, m := range enc.MIMETypes {
			if _, ok := KnownEncoders[m]; !ok {
				knownMIMETypes := make([]string, len(KnownEncoders))
				i := 0
				for k := range KnownEncoders {
					knownMIMETypes[i] = k
					i++
				}
				sort.Strings(knownMIMETypes)
				verr.Add(enc, "Encoders not known for all MIME types, use Package to specify encoder Go package. MIME types with known encoders are %s",
					strings.Join(knownMIMETypes, ", "))
			}
		}
	}
	if enc.Function != "" && enc.PackagePath == "" {
		verr.Add(enc, "Must specify encoder package page with PackagePath")
	}
	return verr
}
849694
func (i *I) Validate(ctx *Context) error {
	_, err := i.template(ctx)
	return err
}
854293
func (m *PathStatus) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateHTTP(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateIcmp(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
961717
func (m *IPAMResponse) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateAddress(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateHostAddressing(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
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
}
933158
func (o *kustomizeOptions) Validate(args []string) error {
	if len(args) > 1 {
		return errors.New("specify one path to a kustomization directory")
	}
	if len(args) == 0 {
		o.kustomizationDir = "./"
	} else {
		o.kustomizationDir = args[0]
	}

	return nil
}
980288
func Validate(info Info) error {
	if info.Name == "" {
		return fmt.Errorf("package name cannot be empty")
	}
	if info.Arch == "" {
		return fmt.Errorf("package arch must be provided")
	}
	if info.Version == "" {
		return fmt.Errorf("package version must be provided")
	}
	if len(info.Files)+len(info.ConfigFiles) == 0 {
		return fmt.Errorf("no files were provided")
	}
	return nil
}
903220
func Validate(passcode string, counter uint64, secret string) bool {
	rv, _ := ValidateCustom(
		passcode,
		counter,
		secret,
		ValidateOpts{
			Digits:    otp.DigitsSix,
			Algorithm: otp.AlgorithmSHA1,
		},
	)
	return rv
}
992758
func (m *LabelConfigurationSpec) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateUser(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
621278
func (pTypeDef *StringTest) Validate() error {
	if pTypeDef.Name == "" {
		return fmt.Errorf("StringTest: Missing required field: name")
	}
	if pTypeDef.Parent == "" {
		return fmt.Errorf("StringTest: Missing required field: parent")
	}
	return nil
}
756174
func (s SourceType) Validate(interface{}) error {
	switch s {
	case SourceDashboard, SourceCLI, SourceSystem, SourceProvider:
		return nil
	default:
		return manifold.NewError(errors.BadRequestError, fmt.Sprintf("invalid source type %q", s))
	}
}
225743
func (m *Lua) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetInlineCode()) < 1 {
		return LuaValidationError{
			field:  "InlineCode",
			reason: "value length must be at least 1 bytes",
		}
	}

	return nil
}
751558
func (m *TLSProperties_CertificateProperties_SubjectAltName) Validate() error {
	if m == nil {
		return nil
	}

	switch m.San.(type) {

	case *TLSProperties_CertificateProperties_SubjectAltName_Uri:
		// no validation rules for Uri

	case *TLSProperties_CertificateProperties_SubjectAltName_Dns:
		// no validation rules for Dns

	}

	return nil
}
742525
func (m *Matcher) Validate() error {
	if !m.Name.IsValid() {
		return fmt.Errorf("invalid name %q", m.Name)
	}
	if m.IsRegex {
		if _, err := regexp.Compile(m.Value); err != nil {
			return fmt.Errorf("invalid regular expression %q", m.Value)
		}
	} else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 {
		return fmt.Errorf("invalid value %q", m.Value)
	}
	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
}
1080003
func (c *ConnectPacket) Validate() byte {
	if c.PasswordFlag && !c.UsernameFlag {
		return ErrRefusedBadUsernameOrPassword
	}
	if c.ReservedBit != 0 {
		//Bad reserved bit
		return ErrProtocolViolation
	}
	if (c.ProtocolName == "MQIsdp" && c.ProtocolVersion != 3) || (c.ProtocolName == "MQTT" && c.ProtocolVersion != 4) {
		//Mismatched or unsupported protocol version
		return ErrRefusedBadProtocolVersion
	}
	if c.ProtocolName != "MQIsdp" && c.ProtocolName != "MQTT" {
		//Bad protocol name
		return ErrProtocolViolation
	}
	if len(c.ClientIdentifier) > 65535 || len(c.Username) > 65535 || len(c.Password) > 65535 {
		//Bad size field
		return ErrProtocolViolation
	}
	if len(c.ClientIdentifier) == 0 && !c.CleanSession {
		//Bad client identifier
		return ErrRefusedIDRejected
	}
	return Accepted
}
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
}