本文整理匯總了Golang中github.com/gophercloud/gophercloud.ServiceClient.Patch方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceClient.Patch方法的具體用法?Golang ServiceClient.Patch怎麽用?Golang ServiceClient.Patch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gophercloud/gophercloud.ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.Patch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Update
// Update changes an existing endpoint with new data.
func Update(client *gophercloud.ServiceClient, endpointID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToEndpointUpdateMap()
if err != nil {
r.Err = err
return
}
_, r.Err = client.Patch(endpointURL(client, endpointID), &b, &r.Body, nil)
return
}
示例2: Update
// Update will modify an existing configuration group by performing a merge
// between new and existing values. If the key already exists, the new value
// will overwrite. All other keys will remain unaffected.
func Update(client *gophercloud.ServiceClient, configID string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToConfigUpdateMap()
if err != nil {
r.Err = err
return
}
_, r.Err = client.Patch(resourceURL(client, configID), &b, nil, nil)
return
}
示例3: Update
// Update implements image updated request
func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToImageUpdateMap()
if err != nil {
r.Err = err
return r
}
_, r.Err = client.Patch(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
MoreHeaders: map[string]string{"Content-Type": "application/openstack-images-v2.1-json-patch"},
})
return
}