示例#1
0
// Update implements image updated request
func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) UpdateResult {
	var res UpdateResult
	reqBody := opts.ToImageUpdateMap()

	_, res.Err = client.Patch(updateURL(client, id), reqBody, &res.Body, &gophercloud.RequestOpts{
		OkCodes:     []int{200},
		MoreHeaders: map[string]string{"Content-Type": "application/openstack-images-v2.1-json-patch"},
	})
	return res
}
示例#2
0
文件: requests.go 项目: vozhyk-/gohan
// Update accepts a UpdateOpts struct and updates an existing project using the
// values provided. For more information, see the Create function.
func Update(client *gophercloud.ServiceClient, projectID string, opts UpdateOptsBuilder) UpdateResult {
	var res UpdateResult

	reqBody, err := opts.ToProjectUpdateMap()
	if err != nil {
		res.Err = err
		return res
	}

	_, res.Err = client.Patch(updateURL(client, projectID), reqBody, &res.Body, nil)
	return res
}