本文整理匯總了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
}
示例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
}
示例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
}