本文整理匯總了Golang中github.com/kumoru/kumoru-sdk-go/pkg/service/application.Application.Show方法的典型用法代碼示例。如果您正苦於以下問題:Golang Application.Show方法的具體用法?Golang Application.Show怎麽用?Golang Application.Show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kumoru/kumoru-sdk-go/pkg/service/application.Application
的用法示例。
在下文中一共展示了Application.Show方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Show
//Show an Application.
func Show(cmd *cli.Cmd) {
uuid := cmd.String(cli.StringArg{
Name: "UUID",
Desc: "Application UUID",
HideValue: true,
})
cmd.Action = func() {
app := application.Application{
UUID: *uuid,
}
application, resp, errs := app.Show()
if errs != nil {
log.Fatalf("Could not retrieve application: %s", errs)
}
if resp.StatusCode != 200 {
log.Fatalf("Could not retrieve application: %s", resp.Status)
}
printAppDetail(application)
}
}
示例2: Deploy
//Deploy an Application
func Deploy(cmd *cli.Cmd) {
uuid := cmd.String(cli.StringArg{
Name: "UUID",
Desc: "Application UUID",
HideValue: true,
})
cmd.Action = func() {
app := application.Application{
UUID: *uuid,
}
application, resp, errs := app.Show() // TODO remove this duplication of application.Show() logic
if errs != nil {
log.Fatalf("Could not retrieve deployment token: %s", errs)
}
if resp.StatusCode != 200 {
log.Fatalf("Could not retrieve deployment token: %s", resp.Status)
}
application, resp, errs = application.Deploy()
if errs != nil {
log.Fatalf("Could not deploy application: %s", errs)
}
if resp.StatusCode != 202 {
log.Fatalf("Could not deploy application: %s", resp.Status)
}
fmt.Printf("Deploying application %s\n", application.UUID)
}
}