本文整理匯總了Golang中github.com/control-center/serviced/domain/service.Service.RemoveVirtualHost方法的典型用法代碼示例。如果您正苦於以下問題:Golang Service.RemoveVirtualHost方法的具體用法?Golang Service.RemoveVirtualHost怎麽用?Golang Service.RemoveVirtualHost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/control-center/serviced/domain/service.Service
的用法示例。
在下文中一共展示了Service.RemoveVirtualHost方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: restRemoveVirtualHost
// restRemoveVirtualHost removes a vhost name from provided service and endpoint. Parameters are defined in path.
func restRemoveVirtualHost(w *rest.ResponseWriter, r *rest.Request, client *node.ControlClient) {
serviceID, err := url.QueryUnescape(r.PathParam("serviceId"))
if err != nil {
glog.Errorf("Failed getting serviceId: %v", err)
restBadRequest(w, err)
return
}
application, err := url.QueryUnescape(r.PathParam("application"))
if err != nil {
glog.Errorf("Failed getting application: %v", err)
restBadRequest(w, err)
return
}
hostname, err := url.QueryUnescape(r.PathParam("name"))
if err != nil {
glog.Errorf("Failed getting hostname: %v", err)
restBadRequest(w, err)
return
}
var service service.Service
err = client.GetService(serviceID, &service)
if err != nil {
glog.Errorf("Unexpected error getting service (%s): %v", serviceID, err)
restServerError(w, err)
return
}
err = service.RemoveVirtualHost(application, hostname)
if err != nil {
glog.Errorf("Unexpected error removing vhost, %s, from service (%s): %v", hostname, serviceID, err)
restServerError(w, err)
return
}
var unused int
err = client.UpdateService(service, &unused)
if err != nil {
glog.Errorf("Unexpected error removing vhost, %s, from service (%s): %v", hostname, serviceID, err)
restServerError(w, err)
return
}
restSuccess(w)
}