func (ot OriginType) ValidateName(name string) error {
	switch ot {
	case OriginTypeUnknown:
		if name != "" {
			return errors.NewNotValid(nil, "origin name must not be set if type is unknown")
		}
	case OriginTypeUser:
		if !names.IsValidUser(name) {
			return errors.NewNotValid(nil, "bad user name")
		}
	case OriginTypeMachine:
		if !names.IsValidMachine(name) {
			return errors.NewNotValid(nil, "bad machine name")
		}
	case OriginTypeUnit:
		if !names.IsValidUnit(name) {
			return errors.NewNotValid(nil, "bad unit name")
		}
	}
	return nil
}
// ValidateName ensures that the given origin name is valid within the
// context of the origin type.
ValidateName ensures that the given origin name is valid within the
context of the origin type.
// ValidateName ensures that the given origin name is valid within the // context of the origin type .
func (ot OriginType) ValidateName(name string) error {
	switch ot {
	case OriginTypeUnknown:
		if name != "" {
			return errors.NewNotValid(nil, "origin name must not be set if type is unknown")
		}
	case OriginTypeUser:
		if !names.IsValidUser(name) {
			return errors.NewNotValid(nil, "bad user name")
		}
	case OriginTypeMachine:
		if !names.IsValidMachine(name) {
			return errors.NewNotValid(nil, "bad machine name")
		}
	case OriginTypeUnit:
		if !names.IsValidUnit(name) {
			return errors.NewNotValid(nil, "bad unit name")
		}
	}
	return nil
}
func ( ot OriginType ) ValidateName ( name string ) error { switch ot { case OriginTypeUnknown : if name != " " { return errors . NewNotValid ( nil , " " ) } case OriginTypeUser : if ! names . IsValidUser ( name ) { return errors . NewNotValid ( nil , " " ) } case OriginTypeMachine : if ! names . IsValidMachine ( name ) { return errors . NewNotValid ( nil , " " ) } case OriginTypeUnit : if ! names . IsValidUnit ( name ) { return errors . NewNotValid ( nil , " " ) } } return nil }
ValidateName ensures that the given origin name is valid within the
context of the origin type.
ValidateName ensures that the given origin name is valid within the context of the origin type .