本文整理匯總了Golang中github.com/control-center/serviced/node.ControlClient.StartService方法的典型用法代碼示例。如果您正苦於以下問題:Golang ControlClient.StartService方法的具體用法?Golang ControlClient.StartService怎麽用?Golang ControlClient.StartService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/control-center/serviced/node.ControlClient
的用法示例。
在下文中一共展示了ControlClient.StartService方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: restStartService
// restStartService starts the service with the given id and all of its children
func restStartService(w *rest.ResponseWriter, r *rest.Request, client *node.ControlClient) {
serviceID, err := url.QueryUnescape(r.PathParam("serviceId"))
if err != nil {
restBadRequest(w, err)
return
}
auto := r.FormValue("auto")
autoLaunch := true
switch auto {
case "1", "True", "true":
autoLaunch = true
case "0", "False", "false":
autoLaunch = false
}
var affected int
if err := client.StartService(dao.ScheduleServiceRequest{serviceID, autoLaunch}, &affected); err != nil {
glog.Errorf("Unexpected error starting service: %s", err)
restServerError(w, err)
return
}
w.WriteJson(&simpleResponse{"Started service", serviceLinks(serviceID)})
}