本文整理匯總了Golang中cf.Application.Stack方法的典型用法代碼示例。如果您正苦於以下問題:Golang Application.Stack方法的具體用法?Golang Application.Stack怎麽用?Golang Application.Stack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf.Application
的用法示例。
在下文中一共展示了Application.Stack方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createApp
func (cmd Push) createApp(appName string, c *cli.Context) (app cf.Application, apiResponse net.ApiResponse) {
newApp := cf.Application{
Name: appName,
Instances: c.Int("i"),
Memory: memoryLimit(c.String("m")),
BuildpackUrl: c.String("b"),
Command: c.String("c"),
}
stackName := c.String("s")
if stackName != "" {
var stack cf.Stack
stack, apiResponse = cmd.stackRepo.FindByName(stackName)
if apiResponse.IsNotSuccessful() {
cmd.ui.Failed(apiResponse.Message)
return
}
newApp.Stack = stack
cmd.ui.Say("Using stack %s...", terminal.EntityNameColor(stack.Name))
}
cmd.ui.Say("Creating app %s in org %s / space %s as %s...",
terminal.EntityNameColor(appName),
terminal.EntityNameColor(cmd.config.Organization.Name),
terminal.EntityNameColor(cmd.config.Space.Name),
terminal.EntityNameColor(cmd.config.Username()),
)
app, apiResponse = cmd.appRepo.Create(newApp)
if apiResponse.IsNotSuccessful() {
cmd.ui.Failed(apiResponse.Message)
return
}
cmd.ui.Ok()
cmd.ui.Say("")
return
}
示例2: createApp
func (p Push) createApp(appName string, c *cli.Context) (app cf.Application, err error) {
newApp := cf.Application{
Name: appName,
Instances: c.Int("instances"),
Memory: getMemoryLimit(c.String("memory")),
BuildpackUrl: c.String("buildpack"),
}
stackName := c.String("stack")
if stackName != "" {
var stack cf.Stack
stack, err = p.stackRepo.FindByName(stackName)
if err != nil {
p.ui.Failed("Error finding stack", err)
return
}
newApp.Stack = stack
p.ui.Say("Using stack %s.", stack.Name)
}
p.ui.Say("Creating %s...", appName)
app, err = p.appRepo.Create(newApp)
if err != nil {
p.ui.Failed("Error creating application", err)
return
}
p.ui.Ok()
domain, err := p.domainRepo.FindByName(c.String("domain"))
if err != nil {
p.ui.Failed("Error loading domain", err)
return
}
hostName := c.String("host")
if hostName == "" {
hostName = app.Name
}
route, err := p.routeRepo.FindByHost(hostName)
if err != nil {
newRoute := cf.Route{Host: hostName}
p.ui.Say("Creating route %s.%s...", newRoute.Host, domain.Name)
route, err = p.routeRepo.Create(newRoute, domain)
if err != nil {
p.ui.Failed("Error creating route", err)
return
}
p.ui.Ok()
} else {
p.ui.Say("Using route %s.%s", route.Host, domain.Name)
}
p.ui.Say("Binding %s.%s to %s...", route.Host, domain.Name, app.Name)
err = p.routeRepo.Bind(route, app)
if err != nil {
p.ui.Failed("Error binding route", err)
return
}
p.ui.Ok()
return
}