func (f F5) GetVIP(string) (*model.VIP, error) { var err error var v model.VIP err = errors.New("Some dumb error") v.Name = "My Test VIP" return &v, err }
func (ra *RestAPI) validateVIPFields(v *model.VIP) (bool, error) { if v.Name == "" { return false, fmt.Errorf("VIP name cannot be empty.") } // Make sure frontend TCP/UDP port is valid if v.FrontendPort < 1 || v.FrontendPort > 65535 { return false, fmt.Errorf("Invalid VIP frontend port: %v", v.FrontendPort) } if v.KubeSvcName == "" || v.KubeSvcPortName == "" { return false, fmt.Errorf("VIP's Kubernetes service name and port name cannot be empty.") } // If a K8S namespace was not provided, just use the default namespace if v.KubeNamespace == "" { v.KubeNamespace = api.NamespaceDefault } // TODO: actually validate them return true, nil }