// Valid returns whether the BankAcct is valid according to the OFX spec
183351
func (b BankAcct) Valid() (bool, error) {
	if len(b.BankID) == 0 {
		return false, errors.New("BankAcct.BankID empty")
	}
	if len(b.AcctID) == 0 {
		return false, errors.New("BankAcct.AcctID empty")
	}
	if !b.AcctType.Valid() {
		return false, errors.New("Invalid or unspecified BankAcct.AcctType")
	}
	return true, nil
}
539752
func (a *Authorization) Valid() error {
	for _, p := range a.Permissions {
		if p.Resource.OrgID != nil && *p.Resource.OrgID != a.OrgID {
			return &Error{
				Msg:  fmt.Sprintf("permission %s is not for org id %s", p, a.OrgID),
				Code: EInvalid,
			}
		}
	}

	return nil
}
1325988
func (p *Project) Valid() bool {
	if p.Name == "" {
		fmt.Println("no project spec name")
		return false
	}

	for _, r := range p.Resources {
		if !r.Valid() {
			return false
		}
	}

	return true
}
633737
func (c *Credential) Valid() bool {
	if c.Key == "" {
		log.Printf("Credential: invalid key")
		return false
	}

	return true
}
609349
func (k internalKey) valid() bool {
	i := len(k) - 8
	return i >= 0 && internalKeyKind(k[i]) <= internalKeyKindMax
}
1266232
func (l PendingTransactionList) Valid() (bool, error) {
	var emptyDate Date
	if l.DtAsOf.Equal(emptyDate) {
		return false, errors.New("PendingTransactionList.DtAsOf not filled")
	}
	for _, t := range l.Transactions {
		if ok, err := t.Valid(); !ok {
			return false, err
		}
	}

	return true, nil
}
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
}
879584
func (level LevelType) valid() bool {
	if TRACE > level || CRITICAL < level {
		return false
	}
	return true
}
976580
func (dbp *Process) Valid() (bool, error) {
	if dbp.detached {
		return false, &proc.ProcessDetachedError{}
	}
	if dbp.exited {
		return false, &proc.ErrProcessExited{Pid: dbp.Pid()}
	}
	return true, nil
}
1141997
func (a *ACL) Valid() error {
	acl_valid, err := getSymbolPointer(a.lib.handle, "acl_valid")
	if err != nil {
		return err
	}

	ret, err := C.my_acl_valid(acl_valid, a.a)
	if ret < 0 {
		return errwrap.Wrap(errors.New("invalid acl"), err)
	}
	return nil
}
962665
func (t *TokenContainer) Valid() bool {
	if t.Token == nil {
		return false
	}
	return t.Token.Valid()
}
736174
func (r *SecListResponse) Valid(version ofxVersion) (bool, error) {
	if ok, err := r.TrnUID.Valid(); !ok {
		return false, err
	}
	// TODO implement
	return true, nil
}
1142565
func (na *NetAddress) Valid() bool {
	if string(na.ID) != "" {
		data, err := hex.DecodeString(string(na.ID))
		if err != nil || len(data) != IDByteLength {
			return false
		}
	}
	return na.IP != nil && !(na.IP.IsUnspecified() || na.RFC3849() ||
		na.IP.Equal(net.IPv4bcast))
}
1300760
func (p *GithubStatus) Valid() bool {
	// owner, repo and ref must be empty or must be set
	ownerEmpty := len(p.Owner) == 0
	repoEmpty := len(p.Repo) == 0
	refLen := len(p.Ref) == 0
	if ownerEmpty != repoEmpty || repoEmpty != refLen {
		return false
	}

	switch p.State {
	case GithubStatePending, GithubStateSuccess, GithubStateError, GithubStateFailure:
	default:
		return false
	}

	_, err := url.Parse(p.URL)
	if err != nil || len(p.Context) == 0 {
		return false
	}

	return true
}
30175
func valid(mfs []*dto.MetricFamily) error {
	// Checks if any timestamps have been specified.
	for i := range mfs {
		for j := range mfs[i].Metric {
			if mfs[i].Metric[j].TimestampMs != nil {
				return ErrMetricsTimestampPresent
			}
		}
	}
	return nil
}
619836
func (acl *ACL) Valid() bool {
	rv := C.acl_valid(acl.a)
	if rv < 0 {
		return false
	}
	return true
}
556320
func (sr *InvStatementResponse) Valid(version ofxVersion) (bool, error) {
	if ok, err := sr.TrnUID.Valid(); !ok {
		return false, err
	}
	//TODO implement
	return true, nil
}