// Valid checks if the resource type is a member of the ResourceType enum.
3696
func (t ResourceType) Valid() (err error) {
	switch t {
	case AuthorizationsResourceType: // 0
	case BucketsResourceType: // 1
	case DashboardsResourceType: // 2
	case OrgsResourceType: // 3
	case TasksResourceType: // 4
	case TelegrafsResourceType: // 5
	case SourcesResourceType: // 6
	case UsersResourceType: // 7
	case VariablesResourceType: // 8
	case ScraperResourceType: // 9
	case SecretsResourceType: // 10
	case LabelsResourceType: // 11
	case ViewsResourceType: // 12
	case DocumentsResourceType: // 13
	default:
		err = ErrInvalidResourceType
	}

	return err
}
609349
func (k internalKey) valid() bool {
	i := len(k) - 8
	return i >= 0 && internalKeyKind(k[i]) <= internalKeyKindMax
}
560297
func (m *ChannelMap) Valid() bool {
	cmap := m.toC()
	return C.pa_channel_map_valid(cmap) != 0
}
477083
func (t Transaction) Valid(version ofxVersion) (bool, error) {
	var emptyDate Date
	if !t.TrnType.Valid() || t.TrnType == TrnTypeHold {
		return false, errors.New("Transaction.TrnType invalid")
	} else if t.DtPosted.Equal(emptyDate) {
		return false, errors.New("Transaction.DtPosted not filled")
	} else if len(t.FiTID) == 0 {
		return false, errors.New("Transaction.FiTID empty")
	} else if len(t.CorrectFiTID) > 0 && t.CorrectAction.Valid() {
		return false, errors.New("Transaction.CorrectFiTID nonempty but CorrectAction invalid")
	} else if len(t.Name) > 0 && t.Payee != nil {
		return false, errors.New("Only one of Transaction.Name and Payee may be specified")
	}
	if t.Payee != nil {
		if ok, err := t.Payee.Valid(); !ok {
			return false, err
		}
	}
	if t.BankAcctTo != nil && t.CCAcctTo != nil {
		return false, errors.New("Only one of Transaction.BankAcctTo and CCAcctTo may be specified")
	} else if t.BankAcctTo != nil {
		if ok, err := t.BankAcctTo.Valid(); !ok {
			return false, err
		}
	} else if t.CCAcctTo != nil {
		if ok, err := t.CCAcctTo.Valid(); !ok {
			return false, err
		}
	}
	if version < OfxVersion220 && len(t.ImageData) > 0 {
		return false, errors.New("Transaction.ImageData only supportd for OFX > 220")
	} else if len(t.ImageData) > 2 {
		return false, errors.New("Only 2 of ImageData allowed in Transaction")
	}
	var ok1, ok2 bool
	if t.Currency != nil {
		ok1, _ = t.Currency.Valid()
	}
	if t.OrigCurrency != nil {
		ok2, _ = t.OrigCurrency.Valid()
	}
	if ok1 && ok2 {
		return false, errors.New("Currency and OrigCurrency both supplied for Pending Transaction, only one allowed")
	}
	return true, nil
}
549399
func (u *MacroUpdate) Valid() error {
	if u.Name == "" && u.Selected == nil && u.Arguments == nil {
		return fmt.Errorf("no fields supplied in update")
	}

	return nil
}
925837
func (m *DefaultRESTMapper) ResourceIsValid(resource string) bool {
	_, err := m.KindFor(resource)
	return err == nil
}
56790
func (ck *MaintenanceWindow) Valid() error {
	if ck.Description == "" {
		return fmt.Errorf("Invalid value for `Description`.  Must contain non-empty string")
	}

	if ck.From == 0 {
		return fmt.Errorf("Invalid value for `From`.  Must contain time")
	}

	if ck.To == 0 {
		return fmt.Errorf("Invalid value for `To`.  Must contain time")
	}

	return nil
}
254529
func (c *Client) Valid() bool {
	if c == nil {
		return false
	}

	if c.Client == nil {
		return false
	}

	// Use arbitrary pointer field in the service content.
	// Doesn't matter which one, as long as it is populated by default.
	if c.ServiceContent.SessionManager == nil {
		return false
	}

	return true
}
683014
func (ou UID) Valid() (bool, error) {
	if len(ou) == 0 || len(ou) > 36 {
		return false, errors.New("UID invalid length")
	}
	return true, nil
}
1239220
func (ut UserType) Valid() (err error) {
	switch ut {
	case Owner: // 1
	case Member: // 2
	default:
		err = ErrInvalidUserType
	}

	return err
}
1291417
func (spec *SampleSpec) Valid() bool {
	if C.pa_sample_spec_valid(spec.toC()) == 0 {
		return false
	}
	return true
}
674501
func (mv *Validator) Valid(val interface{}, tags string) error {
	if tags == "-" {
		return nil
	}
	v := reflect.ValueOf(val)
	if v.Kind() == reflect.Ptr && !v.IsNil() {
		return mv.Valid(v.Elem().Interface(), tags)
	}
	var err error
	switch v.Kind() {
	case reflect.Struct:
		return ErrUnsupported
	case reflect.Invalid:
		err = mv.validateVar(nil, tags)
	default:
		err = mv.validateVar(val, tags)
	}
	return err
}
1243076
func (u *VariableUpdate) Valid() error {
	if u.Name == "" && u.Description == "" && u.Selected == nil && u.Arguments == nil {
		return fmt.Errorf("no fields supplied in update")
	}

	return nil
}
1340496
func (n UsernsMode) Valid() bool {
	parts := strings.Split(string(n), ":")
	switch mode := parts[0]; mode {
	case "", "host":
	default:
		return false
	}
	return true
}
118801
func (h *headerRule) Valid(ctx context.Context) bool {
	return h.valid(ctx.ResponseWriter().Header().Get)
}
114509
func (l LevelInfo) Valid() bool {
	return level.IsValidPriority(l.Default) && level.IsValidPriority(l.Threshold)
}
1251720
func (p *Provider) Valid(hash, plain []byte) bool {
	if !prefixValid(hash) {
		return false
	}

	_, params, saltBytes, expectedKey, err := mcf.Decode(hash, providerName)
	if err != nil {
		return false
	}
	hashParams := paramsFromMCF([]byte(params))

	key, _ := scrypt.Key(plain, saltBytes, hashParams.n, hashParams.r, hashParams.p, hashParams.keyLen)

	return subtle.ConstantTimeCompare(key, expectedKey) == 1
}