Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 8644708

Browse files
James FisherSamuel Ortiz
authored andcommitted
PutImageData
1 parent 7689304 commit 8644708

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

openstack/imageservice/v2/requests.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package v2
22

33
import (
4+
"io"
5+
46
"github.com/rackspace/gophercloud"
57
//"github.com/rackspace/gophercloud/pagination"
68
)
@@ -180,3 +182,16 @@ func (r ReplaceImageTags) ToImagePatchMap() map[string]interface{} {
180182
m["value"] = r.NewTags
181183
return m
182184
}
185+
186+
func PutImageData(client *gophercloud.ServiceClient, id string, data io.ReadSeeker) PutImageDataResult {
187+
var res PutImageDataResult
188+
189+
_, res.Err = client.Put(imageDataURL(client, id), data, nil, &gophercloud.RequestOpts{
190+
MoreHeaders: map[string]string{"Content-Type": "application/octet-stream"},
191+
OkCodes: []int{204},
192+
})
193+
194+
return res
195+
}
196+
197+
// TODO func GetImageData

openstack/imageservice/v2/results.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,7 @@ type UpdateResult struct {
330330
func (u UpdateResult) Extract() (*Image, error) {
331331
return extractImage(u.ErrResult)
332332
}
333+
334+
type PutImageDataResult struct {
335+
gophercloud.ErrResult
336+
}

0 commit comments

Comments
 (0)