本文整理匯總了Golang中github.com/cloudfoundry/cli/plugin.CliConnection.GetApps方法的典型用法代碼示例。如果您正苦於以下問題:Golang CliConnection.GetApps方法的具體用法?Golang CliConnection.GetApps怎麽用?Golang CliConnection.GetApps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/cli/plugin.CliConnection
的用法示例。
在下文中一共展示了CliConnection.GetApps方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Run
func (c *AppLister) Run(cliConnection plugin.CliConnection, args []string) {
orgs, err := cliConnection.GetOrgs()
if err != nil {
fmt.Println("Error getting orgs:", err)
os.Exit(1)
}
for _, org := range orgs {
_, err := cliConnection.CliCommandWithoutTerminalOutput("t", "-o", org.Name)
if err != nil {
fmt.Println("Error targeting org: ", org.Name)
os.Exit(1)
}
apps, err := cliConnection.GetApps()
if err != nil {
fmt.Println("Error getting applications from org: ", org.Name)
os.Exit(1)
}
for _, app := range apps {
fmt.Println(app.Name)
}
}
}
示例2: getMatchedApps
func (cmd *Wildcard) getMatchedApps(cliConnection plugin.CliConnection, args []string) []plugin_models.ApplicationSummary {
pattern := args[1]
output, _ := cliConnection.GetApps()
for i := 0; i < (len(output)); i++ {
ok, _ := filepath.Match(pattern, output[i].Name)
if ok {
cmd.matchedApps = append(cmd.matchedApps, output[i])
}
}
return cmd.matchedApps
}
示例3: GetAppsInOneOrg
func GetAppsInOneOrg(cliConnection plugin.CliConnection, orgName string) ([]plugin_models.GetAppsModel, error) {
_, err := cliConnection.CliCommandWithoutTerminalOutput("target", "-o", orgName)
if err != nil {
return []plugin_models.GetAppsModel{}, errors.New("Failed to target org '" + orgName + "'")
}
apps, err := cliConnection.GetApps()
if err != nil {
return []plugin_models.GetAppsModel{}, errors.New("Failed to get apps in organization '" + orgName + "'")
}
return apps, nil
}
示例4: getMatchedApps
func getMatchedApps(cliConnection plugin.CliConnection, args string) []plugin_models.GetAppsModel {
pattern := args
output, err := cliConnection.GetApps()
checkError(err)
matchedApps := []plugin_models.GetAppsModel{}
for i := 0; i < len(output); i++ {
ok, _ := filepath.Match(pattern, output[i].Name)
if ok {
matchedApps = append(matchedApps, output[i])
}
}
return matchedApps
}
示例5: AppsStateStopped
// AppsStateStopped will return a list of app whose state is running
func (c *DoctorPlugin) AppsStateStopped(cliConnection plugin.CliConnection) []plugin_models.GetAppsModel {
var res []plugin_models.GetAppsModel
appsListing, err := cliConnection.GetApps()
if err != nil {
c.ui.Failed(err.Error())
}
for _, app := range appsListing {
if app.State == "stopped" {
res = append(res, app)
}
}
return res
}