當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。