當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Client.LimitedRequest方法代碼示例

本文整理匯總了Golang中github.com/deis/workflow/client/controller/client.Client.LimitedRequest方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.LimitedRequest方法的具體用法?Golang Client.LimitedRequest怎麽用?Golang Client.LimitedRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/deis/workflow/client/controller/client.Client的用法示例。


在下文中一共展示了Client.LimitedRequest方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: List

// List lists apps on a Deis controller.
func List(c *client.Client, results int) ([]api.App, int, error) {
	body, count, err := c.LimitedRequest("/v1/apps/", results)

	if err != nil {
		return []api.App{}, -1, err
	}

	var apps []api.App
	if err = json.Unmarshal([]byte(body), &apps); err != nil {
		return []api.App{}, -1, err
	}

	return apps, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:15,代碼來源:apps.go

示例2: List

// List keys on a controller.
func List(c *client.Client, results int) ([]api.Key, int, error) {
	body, count, err := c.LimitedRequest("/v1/keys/", results)

	if err != nil {
		return []api.Key{}, -1, err
	}

	var keys []api.Key
	if err = json.Unmarshal([]byte(body), &keys); err != nil {
		return []api.Key{}, -1, err
	}

	return keys, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:15,代碼來源:keys.go

示例3: List

// List certs registered with the controller.
func List(c *client.Client, results int) ([]api.Cert, int, error) {
	body, count, err := c.LimitedRequest("/v1/certs/", results)

	if err != nil {
		return []api.Cert{}, -1, err
	}

	var res []api.Cert
	if err = json.Unmarshal([]byte(body), &res); err != nil {
		return []api.Cert{}, -1, err
	}

	return res, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:15,代碼來源:certs.go

示例4: List

// List users registered with the controller.
func List(c *client.Client, results int) ([]api.User, int, error) {
	body, count, err := c.LimitedRequest("/v1/users/", results)

	if err != nil {
		return []api.User{}, -1, err
	}

	var users []api.User
	if err = json.Unmarshal([]byte(body), &users); err != nil {
		return []api.User{}, -1, err
	}

	return users, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:15,代碼來源:users.go

示例5: List

// List an app's processes.
func List(c *client.Client, appID string, results int) ([]api.Process, int, error) {
	u := fmt.Sprintf("/v1/apps/%s/containers/", appID)
	body, count, err := c.LimitedRequest(u, results)

	if err != nil {
		return []api.Process{}, -1, err
	}

	var procs []api.Process
	if err = json.Unmarshal([]byte(body), &procs); err != nil {
		return []api.Process{}, -1, err
	}

	return procs, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:16,代碼來源:ps.go

示例6: List

// List lists an app's builds.
func List(c *client.Client, appID string, results int) ([]api.Build, int, error) {
	u := fmt.Sprintf("/v1/apps/%s/builds/", appID)
	body, count, err := c.LimitedRequest(u, results)

	if err != nil {
		return []api.Build{}, -1, err
	}

	var builds []api.Build
	if err = json.Unmarshal([]byte(body), &builds); err != nil {
		return []api.Build{}, -1, err
	}

	return builds, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:16,代碼來源:builds.go

示例7: List

// List domains registered with an app.
func List(c *client.Client, appID string, results int) ([]api.Domain, int, error) {
	u := fmt.Sprintf("/v1/apps/%s/domains/", appID)
	body, count, err := c.LimitedRequest(u, results)

	if err != nil {
		return []api.Domain{}, -1, err
	}

	var domains []api.Domain
	if err = json.Unmarshal([]byte(body), &domains); err != nil {
		return []api.Domain{}, -1, err
	}

	return domains, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:16,代碼來源:domains.go

示例8: List

// List lists an app's releases.
func List(c *client.Client, appID string, results int) ([]api.Release, int, error) {
	u := fmt.Sprintf("/v1/apps/%s/releases/", appID)

	body, count, err := c.LimitedRequest(u, results)

	if err != nil {
		return []api.Release{}, -1, err
	}

	var releases []api.Release
	if err = json.Unmarshal([]byte(body), &releases); err != nil {
		return []api.Release{}, -1, err
	}

	return releases, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:17,代碼來源:releases.go

示例9: ListAdmins

// ListAdmins lists administrators.
func ListAdmins(c *client.Client, results int) ([]string, int, error) {
	body, count, err := c.LimitedRequest("/v1/admin/perms/", results)

	if err != nil {
		return []string{}, -1, err
	}

	var users []api.PermsRequest
	if err = json.Unmarshal([]byte(body), &users); err != nil {
		return []string{}, -1, err
	}

	usersList := []string{}

	for _, user := range users {
		usersList = append(usersList, user.Username)
	}

	return usersList, count, nil
}
開發者ID:arschles,項目名稱:deis-controller,代碼行數:21,代碼來源:perms.go


注:本文中的github.com/deis/workflow/client/controller/client.Client.LimitedRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。