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