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


Golang Network.SendPostResourceRequest方法代碼示例

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


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

示例1: AddCatalog

func AddCatalog(network *net.Network, resource string) (map[string]models.CatalogEntitySummary, error) {
	url := "/v1/catalog"
	var entities map[string]models.CatalogEntitySummary
	body, err := network.SendPostResourceRequest(url, resource, "application/json")
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(body, &entities)
	return entities, nil
}
開發者ID:m4rkmckenna,項目名稱:brooklyn-client,代碼行數:10,代碼來源:catalog.go

示例2: Create

func Create(network *net.Network, resource string) (models.TaskSummary, error) {
	url := "/v1/applications"
	var response models.TaskSummary
	body, err := network.SendPostResourceRequest(url, resource, "application/json")
	if err != nil {
		return response, err
	}
	err = json.Unmarshal(body, &response)
	return response, err
}
開發者ID:m4rkmckenna,項目名稱:brooklyn-client,代碼行數:10,代碼來源:applications.go

示例3: AddChildren

func AddChildren(network *net.Network, application, entity, resource string) (models.TaskSummary, error) {
	urlStr := fmt.Sprintf("/v1/applications/%s/entities/%s/children", application, entity)
	var response models.TaskSummary
	body, err := network.SendPostResourceRequest(urlStr, resource, "application/json")
	if err != nil {
		return response, err
	}

	err = json.Unmarshal(body, &response)
	return response, err
}
開發者ID:m4rkmckenna,項目名稱:brooklyn-client,代碼行數:11,代碼來源:entities.go


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