// Valid checks if the resource is a member of the Resource enum.
337570
func (r Resource) Valid() (err error) {
	switch r {
	case AuthorizationsResource: // 0
	case BucketsResource: // 1
	case DashboardsResource: // 2
	case OrgsResource: // 3
	case TasksResource: // 4
	case TelegrafsResource: // 5
	case SourcesResource: // 6
	case UsersResource: //7
	default:
		err = ErrInvalidResource
	}

	return err
}
446535
func (ck *PingCheck) Valid() error {
	if ck.Name == "" {
		return fmt.Errorf("Invalid value for `Name`.  Must contain non-empty string")
	}

	if ck.Hostname == "" {
		return fmt.Errorf("Invalid value for `Hostname`.  Must contain non-empty string")
	}

	if ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&
		ck.Resolution != 30 && ck.Resolution != 60 {
		return fmt.Errorf("invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]", ck.Resolution)
	}
	return nil
}
683014
func (ou UID) Valid() (bool, error) {
	if len(ou) == 0 || len(ou) > 36 {
		return false, errors.New("UID invalid length")
	}
	return true, nil
}
869750
func (csr SummaryPerformanceRequest) Valid() error {
	if csr.Id == 0 {
		return ErrMissingId
	}

	if csr.Resolution != "" && csr.Resolution != "hour" && csr.Resolution != "day" && csr.Resolution != "week" {
		return ErrBadResolution
	}
	return 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
}
1169203
func (r *patchDashboardRequest) Valid() error {
	if !r.DashboardID.Valid() {
		return fmt.Errorf("missing dashboard ID")
	}

	if pe := r.Upd.Valid(); pe != nil {
		return pe
	}
	return nil
}
784936
func (air *AcctInfoResponse) Valid(version ofxVersion) (bool, error) {
	if ok, err := air.TrnUID.Valid(); !ok {
		return false, err
	}
	//TODO implement
	return true, nil
}
633737
func (c *Credential) Valid() bool {
	if c.Key == "" {
		log.Printf("Credential: invalid key")
		return false
	}

	return true
}
736174
func (r *SecListResponse) Valid(version ofxVersion) (bool, error) {
	if ok, err := r.TrnUID.Valid(); !ok {
		return false, err
	}
	// TODO implement
	return true, nil
}
667207
func (c *Config) Valid() error {
	if c.Security.SkipGrantTable && !hasRootPrivilege() {
		return fmt.Errorf("TiDB run with skip-grant-table need root privilege")
	}
	if _, ok := ValidStorage[c.Store]; !ok {
		nameList := make([]string, 0, len(ValidStorage))
		for k, v := range ValidStorage {
			if v {
				nameList = append(nameList, k)
			}
		}
		return fmt.Errorf("invalid store=%s, valid storages=%v", c.Store, nameList)
	}
	if c.Store == "mocktikv" && !c.RunDDL {
		return fmt.Errorf("can't disable DDL on mocktikv")
	}
	if c.Log.File.MaxSize > MaxLogFileSize {
		return fmt.Errorf("invalid max log file size=%v which is larger than max=%v", c.Log.File.MaxSize, MaxLogFileSize)
	}
	c.OOMAction = strings.ToLower(c.OOMAction)

	// lower_case_table_names is allowed to be 0, 1, 2
	if c.LowerCaseTableNames < 0 || c.LowerCaseTableNames > 2 {
		return fmt.Errorf("lower-case-table-names should be 0 or 1 or 2")
	}

	if c.TxnLocalLatches.Enabled && c.TxnLocalLatches.Capacity == 0 {
		return fmt.Errorf("txn-local-latches.capacity can not be 0")
	}

	// For tikvclient.
	if c.TiKVClient.GrpcConnectionCount == 0 {
		return fmt.Errorf("grpc-connection-count should be greater than 0")
	}
	if c.TiKVClient.MaxTxnTimeUse == 0 {
		return fmt.Errorf("max-txn-time-use should be greater than 0")
	}
	return nil
}
366665
func Valid(cpf string) bool {
	isValid, err := AssertValid(cpf)
	if err != nil {
		return false
	}
	return isValid
}
797798
func (m MultiRESTMapper) ResourceIsValid(resource string) bool {
	for _, t := range m {
		if t.ResourceIsValid(resource) {
			return true
		}
	}
	return false
}
556430
func (c CCAcct) Valid() (bool, error) {
	if len(c.AcctID) == 0 {
		return false, errors.New("CCAcct.AcctID empty")
	}
	return true, nil
}
1356457
func (v *Validation) Valid(obj interface{}, args ...string) (ok bool, err error) {
	err = v.validExec(obj, "", args...)
	if err != nil {
		fmt.Println(err)
		return
	}
	if !v.HasErrors() {
		if form, ok := obj.(ValidFormer); ok {
			form.Valid(v)
		}
	}
	ok = v.HasErrors() == false
	return
}
990575
func (t Tile) Valid() bool {
	maxIndex := uint32(1) << uint32(t.Z)
	return t.X < maxIndex && t.Y < maxIndex
}
1285373
func (r *StatementRequest) Valid(version ofxVersion) (bool, error) {
	if ok, err := r.TrnUID.Valid(); !ok {
		return false, err
	}
	if r.IncludePending && version < OfxVersion220 {
		return false, errors.New("StatementRequest.IncludePending invalid for OFX < 2.2")
	}
	if r.IncTranImg && version < OfxVersion210 {
		return false, errors.New("StatementRequest.IncTranImg invalid for OFX < 2.1")
	}
	return r.BankAcctFrom.Valid()
}
406398
func (itr *memDBIterator) Valid() bool {
	return 0 <= itr.cur && itr.cur < len(itr.keys)
}