func (origin Origin) Validate() error {
	// Any IPs is fine.

	if origin.EnterpriseID.isZero() {
		if origin.SoftwareName != "" {
			return fmt.Errorf("empty EnterpriseID")
		}
	} else {
		if err := origin.EnterpriseID.Validate(); err != nil {
			return fmt.Errorf("bad EnterpriseID: %v", err)
		}
	}

	if origin.SoftwareName == "" {
		if origin.SoftwareVersion == version.Zero {
			return fmt.Errorf("empty SoftwareName")
		}
	} else {
		size := utf8.RuneCountInString(origin.SoftwareName)
		if size > originSoftwareMax {
			return fmt.Errorf("SoftwareName too big (%d UTF-8 > %d max)", size, originSoftwareMax)
		}
	}

	if origin.SoftwareVersion != version.Zero {
		size := utf8.RuneCountInString(origin.SoftwareVersion.String())
		if size > originVersionMax {
			return fmt.Errorf("SoftwareVersion too big (%d UTF-8 > %d max)", size, originVersionMax)
		}
	}

	return nil
}
// Validate ensures that the element is correct.
Validate ensures that the element is correct.
// Validate ensures that the element is correct .
func (origin Origin) Validate() error {
	if origin.EnterpriseID.isZero() {
		if origin.SoftwareName != "" {
			return fmt.Errorf("empty EnterpriseID")
		}
	} else {
		if err := origin.EnterpriseID.Validate(); err != nil {
			return fmt.Errorf("bad EnterpriseID: %v", err)
		}
	}
	if origin.SoftwareName == "" {
		if origin.SoftwareVersion == version.Zero {
			return fmt.Errorf("empty SoftwareName")
		}
	} else {
		size := utf8.RuneCountInString(origin.SoftwareName)
		if size > originSoftwareMax {
			return fmt.Errorf("SoftwareName too big (%d UTF-8 > %d max)", size, originSoftwareMax)
		}
	}
	if origin.SoftwareVersion != version.Zero {
		size := utf8.RuneCountInString(origin.SoftwareVersion.String())
		if size > originVersionMax {
			return fmt.Errorf("SoftwareVersion too big (%d UTF-8 > %d max)", size, originVersionMax)
		}
	}
	return nil
}
func ( origin Origin ) Validate ( ) error { if origin . EnterpriseID . isZero ( ) { if origin . SoftwareName != " " { return fmt . Errorf ( " " ) } } else { if err := origin . EnterpriseID . Validate ( ) ; err != nil { return fmt . Errorf ( " " , err ) } } if origin . SoftwareName == " " { if origin . SoftwareVersion == version . Zero { return fmt . Errorf ( " " ) } } else { size := utf8 . RuneCountInString ( origin . SoftwareName ) if size > originSoftwareMax { return fmt . Errorf ( " " , size , originSoftwareMax ) } } if origin . SoftwareVersion != version . Zero { size := utf8 . RuneCountInString ( origin . SoftwareVersion . String ( ) ) if size > originVersionMax { return fmt . Errorf ( " " , size , originVersionMax ) } } return nil }
Validate ensures that the element is correct.
Validate ensures that the element is correct .
// Any IPs is fine.