func (info *TargetInfo) Validate() error {
	if !names.IsValidModel(info.ControllerTag.Id()) {
		return errors.NotValidf("ControllerTag")
	}

	if len(info.Addrs) < 1 {
		return errors.NotValidf("empty Addrs")
	}
	for _, addr := range info.Addrs {
		_, err := network.ParseMachineHostPort(addr)
		if err != nil {
			return errors.NotValidf("%q in Addrs", addr)
		}
	}

	if info.AuthTag.Id() == "" {
		return errors.NotValidf("empty AuthTag")
	}

	if info.Password == "" && len(info.Macaroons) == 0 {
		return errors.NotValidf("missing Password & Macaroons")
	}

	return nil
}
// Validate returns an error if the TargetInfo contains bad data. Nil
// is returned otherwise.
Validate returns an error if the TargetInfo contains bad data. Nil
is returned otherwise.
// Validate returns an error if the TargetInfo contains bad data . Nil // is returned otherwise .
func (info *TargetInfo) Validate() error {
	if !names.IsValidModel(info.ControllerTag.Id()) {
		return errors.NotValidf("ControllerTag")
	}
	if len(info.Addrs) < 1 {
		return errors.NotValidf("empty Addrs")
	}
	for _, addr := range info.Addrs {
		_, err := network.ParseMachineHostPort(addr)
		if err != nil {
			return errors.NotValidf("%q in Addrs", addr)
		}
	}
	if info.AuthTag.Id() == "" {
		return errors.NotValidf("empty AuthTag")
	}
	if info.Password == "" && len(info.Macaroons) == 0 {
		return errors.NotValidf("missing Password & Macaroons")
	}
	return nil
}
func ( info * TargetInfo ) Validate ( ) error { if ! names . IsValidModel ( info . ControllerTag . Id ( ) ) { return errors . NotValidf ( " " ) } if len ( info . Addrs ) < 1 { return errors . NotValidf ( " " ) } for _ , addr := range info . Addrs { _ , err := network . ParseMachineHostPort ( addr ) if err != nil { return errors . NotValidf ( " " , addr ) } } if info . AuthTag . Id ( ) == " " { return errors . NotValidf ( " " ) } if info . Password == " " && len ( info . Macaroons ) == 0 { return errors . NotValidf ( " " ) } return nil }
Validate returns an error if the TargetInfo contains bad data.
Validate returns an error if the TargetInfo contains bad data .