本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/models.Application.HasRoute方法的典型用法代碼示例。如果您正苦於以下問題:Golang Application.HasRoute方法的具體用法?Golang Application.HasRoute怎麽用?Golang Application.HasRoute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/cli/cf/models.Application
的用法示例。
在下文中一共展示了Application.HasRoute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: BindRoute
func (routeActor routeActor) BindRoute(app models.Application, route models.Route) error {
if !app.HasRoute(route) {
routeActor.ui.Say(T(
"Binding {{.URL}} to {{.AppName}}...",
map[string]interface{}{
"URL": terminal.EntityNameColor(route.URL()),
"AppName": terminal.EntityNameColor(app.Name),
}),
)
err := routeActor.routeRepo.Bind(route.GUID, app.GUID)
switch err := err.(type) {
case nil:
routeActor.ui.Ok()
routeActor.ui.Say("")
return nil
case errors.HTTPError:
if err.ErrorCode() == errors.InvalidRelation {
return errors.New(T(
"The route {{.URL}} is already in use.\nTIP: Change the hostname with -n HOSTNAME or use --random-route to generate a new route and then push again.",
map[string]interface{}{
"URL": route.URL(),
}),
)
}
}
return err
}
return nil
}