// Validate ensures the credential body is valid
425512
func (body CredentialBody) Validate(_ interface{}) error {
	if len(body) > maxCredentialBodySize {
		return errInvalidCredentialValue
	}

	return nil
}
477425
func (m *Principal_Authenticated) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetPrincipalName()

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

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

	return nil
}
268382
func (m *GrpcService_GoogleGrpc_ChannelCredentials) Validate() error {
	if m == nil {
		return nil
	}

	switch m.CredentialSpecifier.(type) {

	case *GrpcService_GoogleGrpc_ChannelCredentials_SslCredentials:

		{
			tmp := m.GetSslCredentials()

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

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

	case *GrpcService_GoogleGrpc_ChannelCredentials_GoogleDefault:

		{
			tmp := m.GetGoogleDefault()

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

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

	case *GrpcService_GoogleGrpc_ChannelCredentials_LocalCredentials:

		{
			tmp := m.GetLocalCredentials()

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

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

	default:
		return GrpcService_GoogleGrpc_ChannelCredentialsValidationError{
			field:  "CredentialSpecifier",
			reason: "value is required",
		}

	}

	return nil
}
17798
func (a *Authenticator) Validate(context.Context, *http.Request) (oauth2.Principal, error) {
	return a.Principal, a.ValidateErr
}
378257
func (m *Principal) Validate() error {
	if m == nil {
		return nil
	}

	switch m.Identifier.(type) {

	case *Principal_AndIds:

		{
			tmp := m.GetAndIds()

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

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

	case *Principal_OrIds:

		{
			tmp := m.GetOrIds()

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

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

	case *Principal_Any:

		if m.GetAny() != true {
			return PrincipalValidationError{
				field:  "Any",
				reason: "value must equal true",
			}
		}

	case *Principal_Authenticated_:

		{
			tmp := m.GetAuthenticated()

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

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

	case *Principal_SourceIp:

		{
			tmp := m.GetSourceIp()

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

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

	case *Principal_Header:

		{
			tmp := m.GetHeader()

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

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

	case *Principal_Metadata:

		{
			tmp := m.GetMetadata()

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

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

	case *Principal_NotId:

		{
			tmp := m.GetNotId()

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

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

	default:
		return PrincipalValidationError{
			field:  "Identifier",
			reason: "value is required",
		}

	}

	return nil
}
710404
func (m *Certificates) Validate() error {
	if m == nil {
		return nil
	}

	for idx, item := range m.GetCertificates() {
		_, _ = idx, item

		{
			tmp := item

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

				if err := v.Validate(); err != nil {
					return CertificatesValidationError{
						field:  fmt.Sprintf("Certificates[%v]", idx),
						reason: "embedded message failed validation",
						cause:  err,
					}
				}
			}
		}

	}

	return nil
}
1366046
func (s *SnapshotCreateRepositoryService) Validate() error {
	var invalid []string
	if s.repository == "" {
		invalid = append(invalid, "Repository")
	}
	if s.bodyString == "" && s.bodyJson == nil && len(s.settings) == 0 {
		invalid = append(invalid, "BodyJson")
	}
	if len(invalid) > 0 {
		return fmt.Errorf("missing required fields: %v", invalid)
	}
	return nil
}
342060
func (s *MigrationSpec) Validate() error {
	if !names.IsValidModel(s.ModelUUID) {
		return errors.NotValidf("model UUID")
	}
	if !names.IsValidModel(s.TargetControllerUUID) {
		return errors.NotValidf("controller UUID")
	}
	if len(s.TargetAddrs) < 1 {
		return errors.NotValidf("empty target API addresses")
	}
	if !names.IsValidUser(s.TargetUser) {
		return errors.NotValidf("target user")
	}
	if s.TargetPassword == "" && len(s.TargetMacaroons) == 0 {
		return errors.NotValidf("missing authentication secrets")
	}
	return nil
}
526134
func (srv *Server) Validate() bool {
	if srv.debug {
		return true
	}
	timestamp := srv.Query("timestamp")
	nonce := srv.Query("nonce")
	signature := srv.Query("signature")
	return signature == util.Signature(srv.Token, timestamp, nonce)
}
1285250
func (m *ServiceSpec) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
1217156
func (d multiValidator) Validate(s interface{}) error {
	for _, validator := range d {
		if err := validator.Validate(s); err != nil {
			return err
		}
	}

	return nil
}
71908
func (d *API) validate() error {
	var consumes []string
	for k := range d.consumers {
		consumes = append(consumes, k)
	}

	var produces []string
	for k := range d.producers {
		produces = append(produces, k)
	}

	var authenticators []string
	for k := range d.authenticators {
		authenticators = append(authenticators, k)
	}

	var operations []string
	for m, v := range d.operations {
		for p := range v {
			operations = append(operations, fmt.Sprintf("%s %s", strings.ToUpper(m), p))
		}
	}

	var definedAuths []string
	for k := range d.spec.Spec().SecurityDefinitions {
		definedAuths = append(definedAuths, k)
	}

	if err := d.verify("consumes", consumes, d.analyzer.RequiredConsumes()); err != nil {
		return err
	}
	if err := d.verify("produces", produces, d.analyzer.RequiredProduces()); err != nil {
		return err
	}
	if err := d.verify("operation", operations, d.analyzer.OperationMethodPaths()); err != nil {
		return err
	}

	requiredAuths := d.analyzer.RequiredSecuritySchemes()
	if err := d.verify("auth scheme", authenticators, requiredAuths); err != nil {
		return err
	}
	if err := d.verify("security definitions", definedAuths, requiredAuths); err != nil {
		return err
	}
	return nil
}
71214
func (ref *Ref) Validate(serializedID []byte) error {
	membership, err := ref.get()
	if err != nil {
		return err
	}
	return membership.Validate(serializedID)
}
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
}
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
}
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
}
235640
func (m *CertificateValidationContext) Validate() error {
	if m == nil {
		return nil
	}

	{
		tmp := m.GetTrustedCa()

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

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

	for idx, item := range m.GetVerifyCertificateSpki() {
		_, _ = idx, item

		if len(item) != 44 {
			return CertificateValidationContextValidationError{
				field:  fmt.Sprintf("VerifyCertificateSpki[%v]", idx),
				reason: "value length must be 44 bytes",
			}
		}

	}

	for idx, item := range m.GetVerifyCertificateHash() {
		_, _ = idx, item

		if l := len(item); l < 64 || l > 95 {
			return CertificateValidationContextValidationError{
				field:  fmt.Sprintf("VerifyCertificateHash[%v]", idx),
				reason: "value length must be between 64 and 95 bytes, inclusive",
			}
		}

	}

	{
		tmp := m.GetRequireOcspStaple()

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

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

	{
		tmp := m.GetRequireSignedCertificateTimestamp()

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

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

	{
		tmp := m.GetCrl()

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

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

	// no validation rules for AllowExpiredCertificate

	return nil
}