// Check checks if OpsCenter link parameters are correct
Check checks if OpsCenter link parameters are correct
// Check checks if OpsCenter link parameters are correct
func (l *OpsCenterLink) Check() error {
	if l.SiteDomain == "" {
		return trace.BadParameter("missing parameter SiteDomain")
	}
	if l.Hostname == "" {
		return trace.BadParameter("missing parameter Hostname")
	}
	if l.Type == "" {
		return trace.BadParameter("missing parameter Type")
	}
	if l.Type != OpsCenterRemoteAccessLink && l.Type != OpsCenterUpdateLink {
		return trace.BadParameter("link type should be either %v or %v, got: %v",
			OpsCenterRemoteAccessLink, OpsCenterRemoteAccessLink, l.Type)
	}
	if l.RemoteAddr == "" {
		return trace.BadParameter("missing parameter RemoteAddr")
	}
	if l.APIURL == "" {
		return trace.BadParameter("missing parameter APIURL")
	}
	if _, err := teleutils.ParseAddr(l.RemoteAddr); err != nil {
		return trace.Wrap(err)
	}
	return nil
}
func ( l * OpsCenterLink ) Check ( ) error { if l . SiteDomain == " " { return trace . BadParameter ( " " ) } if l . Hostname == " " { return trace . BadParameter ( " " ) } if l . Type == " " { return trace . BadParameter ( " " ) } if l . Type != OpsCenterRemoteAccessLink && l . Type != OpsCenterUpdateLink { return trace . BadParameter ( " " , OpsCenterRemoteAccessLink , OpsCenterRemoteAccessLink , l . Type ) } if l . RemoteAddr == " " { return trace . BadParameter ( " " ) } if l . APIURL == " " { return trace . BadParameter ( " " ) } if _ , err := teleutils . ParseAddr ( l . RemoteAddr ) ; err != nil { return trace . Wrap ( err ) } return nil }
Check checks if OpsCenter link parameters are correct
Check checks if OpsCenter link parameters are correct