本文整理汇总了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
}