本文整理匯總了Golang中github.com/apache/brooklyn-client/cli/net.Network.SendPostRequest方法的典型用法代碼示例。如果您正苦於以下問題:Golang Network.SendPostRequest方法的具體用法?Golang Network.SendPostRequest怎麽用?Golang Network.SendPostRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/apache/brooklyn-client/cli/net.Network
的用法示例。
在下文中一共展示了Network.SendPostRequest方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PostConfig
func PostConfig(network *net.Network, application, entity, config, value string) (string, error) {
url := fmt.Sprintf("/v1/applications/%s/entities/%s/config", application, entity)
val := []byte(value)
body, err := network.SendPostRequest(url, val)
if nil != err {
return "", err
}
return string(body), nil
}
示例2: CreateFromBytes
func CreateFromBytes(network *net.Network, blueprint []byte) (models.TaskSummary, error) {
url := "/v1/applications"
var response models.TaskSummary
body, err := network.SendPostRequest(url, blueprint)
if err != nil {
return response, err
}
err = json.Unmarshal(body, &response)
return response, err
}