当前位置: 首页>>代码示例>>Golang>>正文


Golang CliConnection.GetApps方法代码示例

本文整理汇总了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)
		}
	}
}
开发者ID:simonleung8,项目名称:cli-plugin-examples,代码行数:25,代码来源:main.go

示例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
}
开发者ID:guidowb,项目名称:Wildcard_Plugin,代码行数:11,代码来源:wildcard_plugin.go

示例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
}
开发者ID:simonleung8,项目名称:cli-plugin-examples,代码行数:13,代码来源:list-apps.go

示例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
}
开发者ID:lemaral,项目名称:Wildcard_Plugin,代码行数:13,代码来源:wildcard_plugin.go

示例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
}
开发者ID:afeld,项目名称:cf-doctor-plugin,代码行数:15,代码来源:main.go


注:本文中的github.com/cloudfoundry/cli/plugin.CliConnection.GetApps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。